Try adding a call to glutSwapBuffers(); at the end of drawScene and remove GLUT_SINGLE from glutInitDisplayMode . Single-buffer mode has all sorts of compatibility issues. On Windows, it uses a software rasterizer, which is VERY slow and has even more problems.
If this does not work, try clearing the depth buffer by changing glClear to glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); and glClearcolor on glClearColor(1.0, 1.0, 1.0, 1.0); .
In addition, this example uses legacy OpenGL, which is significantly slower than modern OpenGL, and has many other problems. If you have not used the GPU for more than ten years, you have no reason to use it. Technically, modern GPUs are not even required to support it. If you need a good modern OpenGL tutorial, http://open.gl is a good one. Just find the OpenGL 2.1 tutorial (or later).
source share