i drew several rectangles on top of one another on screen. Now I want to use the top most rect and make a certain part of it transparent. How do I focus on the topmost rect and do the transparency?
12-14-2003, 11:15 PM
OpenGL is a state machine, you before you render anything you change the state of opengl to want you want (color, transparency, transformation, fog and so on), render your rectangle and then restore or modify the state and render the next thing.
Transparency is activated with glEnable( GL_BLEND), this wil "blend" the color of your rectangle with whatever is in the background (the 4th color value, the alpha value is used to set the transparency of the color), but please notice that there are a few other things to take care of to make your objects transparent, the NeHe tutorials has examples and google is full of them.
And finally, opengl uses a pipeline to do the rendering, you give opengl everything to render, when opengl is done with it it throws it away, so if you need to "modify" something you have to modify the object yourself and render it again, opengl does not have any information about your objects, it just keeps the triangles in memory long enough to render the result, then it is no longer needed.
[This message has been edited by mikael_aronsson (edited 12-15-2003).]
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.