Appendix A contains the C source code for a simple OpenGL program. This example demonstrates what is involved when programming OpenGL with Xlib. The program creates a window and draws a 3D cube (missing two faces) and allows the user to rotate the cube around the X, Y, and Z axes using the mouse buttons.
Besides demonstrating how to properly establish an X window for OpenGL rendering, the example demonstrates the use of double buffering, display lists, and establishing the proper viewing parameters.