Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


How to Frame an OGL Texture


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Aman   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 November 2001 - 01:05 AM

Hello, and thanks up front for taking the time to read this, I have a texture skinned to a rotating quad, I would like to frame (like a picture frame) this quad. Currently I have just been painting the frame onto the texture externally, but I would like to have a set frame and swap through many different pics. What would be the most efficient way of doing this? Make a "frame" model and "attach" it to the quad and just swap out the quad texture? Or can I do frame and quad as one model, and use multiple textures???? Any other Ideas??? Thanks again, Andrew ps.. I know from sky boxes and "water" in progs I''ve made that "attaching" different "models" in an animated enviroment creates an unpleasent tesselation(?) effect. I would like to avoid this if possible.

Sponsor:

#2 Fruny   Moderators   -  Reputation: 1653

Like
Likes
Like

Posted 20 November 2001 - 05:05 AM

I don''t quite get what you mean by separate models here, but GL gives you complete control of when to texture, and which one to use.

Just bind the texture you which to use before rendering the quad, and bind another one (or disable texturing altogether) before rendering the frame. You might also want to lookup glPolygonOffset() if you plan on superposing two polygons at the same coordinates.

I don''t see where tesselation comes into play, sorry

#3 mkaltner   Members   -  Reputation: 122

Like
Likes
Like

Posted 20 November 2001 - 07:44 AM

You'll want to use both the orhtoscopic and perspective matrix to achieve this effect.

something like:
    
GLvoid RenderScene(GLvoid)
{
...
glOrtho(...);
...
// draw quad with frame texture

...
gluPerspective(...);
// draw cube with textures

...
}


doing so would draw the frame, and the rotating cube in front of it. I've done this kind of thing before with a tictactoe game. Check out http://kaltner.slickness.org/files/TSquared.zip to se what I mean.

There's a little more to it but that's the process. If you don't know how to do this, I will provide some example code.

- Mike

EDIT: After re-reading your post, i think maybe I mis-understood. I think what you want is multi-texturing. Apply the first texture, then apply a frame texture over the first. in either case, one of these approaches has to be correct. =)

Edited by - mkaltner on November 20, 2001 2:58:53 PM

#4 Aman   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 November 2001 - 01:39 AM

Thanks everyone for taking the time to answer...Its appreciated,

What I am doing is basically rendering a picture frame like the
one that hangs on a wall and rotating it in 3d space, I was
using a quad with a picture mapped to it. This picture had
been edited to look like it was in a picture frame. I now
want to keep the "frame" and swap a series of pictures in
it. I''ve come to the conclusion that the best way is to create
a 3d rectangle and map a frame texture on it with one side
transparent inside this I will place the quad with the picture
mapped on it then rotate them together, swapping the picture
on the quad. I think this will be the easiest and fastest
way to do this. However thanks again for helping me "brainstorm"
my way to an answer 8o)

Andrew




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS