How to Frame an OGL Texture

Started by
2 comments, last by Aman 22 years, 4 months ago
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.
Its better to be silent and thought a foolthen to speak and remove all doubt.
Advertisement
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
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
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
"The important thing to remember when programming is: When you're 90% complete, there's still 50% more to go."
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
Its better to be silent and thought a foolthen to speak and remove all doubt.

This topic is closed to new replies.

Advertisement