PDA

View Full Version : glDepthMask() not working?



Rhaegar
03-29-2003, 11:10 PM
glDisable(GL_LIGHTING);
glDepthMask(GL_FALSE);
glPushMatrix();

// the Raster call takes into account the
// movement of my 3d camera so that the
// text "X" is always fixed on the screen

glLoadIdentity();
glTranslatef(0.0f, 0.0f, -3.3f);
glRasterPos2f(0.0f, camera.yPos);
glPrint("X");

glPopMatrix();
glDepthMask(GL_TRUE);
glEnable(GL_LIGHTING);

However, the glDepthMask call doesn't seem to work. Give that I set it to False before drawing the -3.3f should have no effect, shouldn't it, except in moving it away from the front of the camera? Maybe I'm confused as to what glDepthMask should do. What I am trying to achieve is to print the "X" on top of anything else currently on the screen (my 3d objects). Currently when I get within 3.3f of the object the text will disappear.

Bob
03-30-2003, 12:04 AM
glDepthMAsk(GL_FALSE) disables depth writes, i.e. makes it read only, but the depth test is unaffected. If you want to draw the X ontop of everything, you have to disable the depth test instead.

[This message has been edited by Bob (edited 03-30-2003).]