Original Post
Hey all, I'm trying to get depth testing for a very simple OpenGL program working (it simply draws a figure on the window using cubes of different colours). The code works fine without the z-buffer enabled (the figure is drawn correctly), but as soon as I call glEnable(GL_DEPTH_TEST) I simply get a black screen. I've set up my pixel format (i'm using the standard windows api to create my window) so that it has 32bits for the depth buffer : PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_TYPE_RGBA, 32, 0,0,0,0,0,0, 0, 0, 0, 0,0,0,0, 32, 0, 0, PFD_MAIN_PLANE, 0, 0,0,0}; And every time my rendering function executes, I call glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); To clear the screen and the depth buffer. Any idea why I would be getting the black screen when I enable depth testing (which I want to enable so that I can animate my figure). The orientation of the polygons shouldn't matter, should it?