PDA

View Full Version : glEnable(GL_DEPTH_TEST); weird problem



scrodde
08-26-2006, 08:38 AM
when i render a quad with the following code without
enabling depthtest it shows up normally. but when i enable depthtest it just doesnt show up. what could the problem be?

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glLoadIdentity();
//glEnable(GL_DEPTH_TEST);
glColor4f(1.0f, 0.0f, 1.0f,1.0f);

glPushMatrix();
glTranslatef( 0, 0, -1 );
glNormal3f(0.0f, 1.0f, 0.0f );
glBegin(GL_QUADS);
glVertex3f( -10, 10, 0 );
glVertex3f( -10, -10, 0 );
glVertex3f( 10, -10, 0 );
glVertex3f( 10, 10, 0);
glEnd();
glPopMatrix();

SwapBuffers(hDC);Init :

PIXELFORMATDESCRIPTOR pfd = { 0 };
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pfd.nVersion = 1;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = mBpp;
pfd.cDepthBits = 16;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL |
PFD_DOUBLEBUFFER;
pfd.iLayerType = PFD_MAIN_PLANE;