• Advertisement
Sign in to follow this  

Depth Test Problem

This topic is 3655 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does GL_DEPTH_TEST state interact with texturing states by any means? Here's the code I have trouble with. void SetRenderStates() { glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glMultMatrixd(&m_quadProjMatd[0][0]); //glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glActiveTexture(GL_TEXTURE0); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glEnable(GL_TEXTURE_RECTANGLE_ARB); } void DrawQuad() { glDisable(GL_DEPTH_TEST); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, m_tex); glBegin(GL_QUADS); ..... glEnd(); glEnable(GL_DEPTH_TEST); } void RestoreRenderStates() { glDisable(GL_TEXTURE_RECTANGLE_ARB); glDisable(GL_BLEND); //glEnable(GL_DEPTH_TEST); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix(); } main() { .... SetRenderStates(); for (...) { Draw(); } RestoreRenderStates(); } Before Draw(), depth test should be disabled then enabled after rendering a set of quads. It works when I switch depth test state within draw block, however when I add gl Enable/Disable depth test to the set/reset rendering functions, the textures appear missed up and somehow drifted and magnified....any reason? Hardware ATI MobilityRadeon X1600.

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement