HomeModulesModule 4 (Graphics/OpenGL) Reflect
I ntroduce
C onnect
A pply
R eflect
E xtend

Reflect - Graphics/OpenGL

As you have seen, there are a number of options pertaining to OpenGL programming. One such option is the use of multiple buffers to render graphics, which was employed in each of the box example codes. While buffers may be difficult to conceptualize, the effect of using only one buffer is readily apparent. Try changing one of the examples from GLUT_DOUBLE to GLUT_SINGLE, which will instruct GLUT to use a singular buffer.

After modifying the OpenGL program, try running both the original and modified OpenGL program. The single buffered program appears jarring, the output is severely distorted, and the screen is likely flickering. Conversely, the double buffered program continues to work as expected. Can you guess why this happens?

As you may have guessed, when OpenGL uses a single buffer, it has to render directly to the screen. Use of a secondary buffer allows OpenGL to render the entire image before presenting it on the screen, creating a significantly smoother and refined image.

You have been exposed to a brief sampling of OpenGL functions; nevertheless, it should be apparent that implementing OpenGL directly would prove tedious if not daunting. However this is precisely what modern games do, even writing significant portions in assembly code. Can you guess why this might be necessary?

Click here to move on to the next section (Extend).