We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Simple depth rendering
Page Index Toggle Pages: 1
Simple depth rendering (Read 405 times)
Simple depth rendering
Sep 3rd, 2008, 6:22am
 
I have a very simple OpenGL 3D scene that I'm trying to render that contains 2 semi-transparent boxes, one in front of the other. I'd like to render them with glDepthMask turned on and with the boxes rendered from back to front as suggested here: http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1210475303;start=2#3. (I want to render the scene with glDepthMask on because this is a test for a more complicated scene)

The problem is that the objects do not display the way I expect. I would expect them to display in exactly the same manner as if I had glDepthMask turned off. My draw method contains the following code:

-------------------------------------------
background( .85f );
camera( 0, 0, 200, 0, 0, 0, 0, 1, 0 );
fill( .5f, 0, 0, .5f );
pushMatrix();
translate( -70, 0, -100 );
box( 100 );
popMatrix();
fill( 0, 0, .5f, .5f );
box( 100 );
-------------------------------------------

Are there additional OpenGL calls I need to make in order for these cubes to display correctly?
Thanks in advance for your help.
Page Index Toggle Pages: 1