Sign in to follow this  

Depth Test Problem

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this