Archived

This topic is now archived and is closed to further replies.

Aman

How to Frame an OGL Texture

Recommended Posts

Aman    122
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.

Share this post


Link to post
Share on other sites
Fruny    1658
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

Share this post


Link to post
Share on other sites
mkaltner    122
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

Share this post


Link to post
Share on other sites
Aman    122
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

Share this post


Link to post
Share on other sites