Don't forget you'll also need these two pieces to get your depth buffer working: At the beginning of your init function, you must change initdisplaymode to look like this: glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); Also at the beginning of your display function, you'll want to clear out the depth buffer with: glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); Of course, you'll also need to enable the depth buffer, but you likely already did that in your init function: glEnable(GL_DEPTH_TEST);