The program's initialization proceeds through the following steps:
In the program's main routine, the first task is to process the supported command line arguments. Users of the X Window System should be familiar with -display which specifies the X server to use, -geometry which specifies the initial size and location of the program's main window, and -iconic which requests the window be initially iconified. Programmers used to the IRIS GL (the predecessor to OpenGL) may not be familiar with these options. While nothing requires an X program to accept standard X options, most do as a matter of consistency and convenience. Most X toolkits automatically understand the standard set of X options
The -keepaspect option is not a standard X command line option. When specified, it requests that the window manager ensure that the ratio between the initial width and height of the window be maintained. Often for 3D programs, the programmer would like a constant aspect ratio for their rendering window. In IRIS GL, a call named keepaspect is available. Maintaining the aspect ratio of a window is something for the window system to do so there is no call analogous to IRIS GL's keepaspect in OpenGL. Remember that the core OpenGL Application Programmer Interface (API) attempts to be window system independent. IRIS GL programmers used to the IRIS GL interface will need to become aware of X functionality to do things that used to be done with IRIS GL calls.
Normally glxdino tries to use a double buffered window but will use a single buffered window if a double buffered visual is not available. When the -single option is present, the program will look only for a single buffered visual. On many machines with hardware double buffering support, color resolution can be traded for double buffering to achieve smooth animation. For example, a machine with 24 bits of color resolution could support 12 bits of color resolution for double buffered mode. Half the image bit-planes would be for the front buffer and half for the back buffer.
Next, a connection to the X server is established using XOpenDisplay. Since glxdino requires OpenGL's GLX extension, the program checks that the extension exists using glXQueryExtension. The routine indicates if the GLX extension is supported or not. As is convention for X routines that query extensions, the routine can also return the base error code and base event code for the GLX extension. The current version of GLX supports no extension events (but does define eight protocol errors). Most OpenGL programs will need neither of these numbers. You can pass in NULL as glxdino does to indicate you do not need the event or error base.
OpenGL is designed for future extensibility. The glXQueryVersion routine returns the major and minor version of the OpenGL implementation. Currently, the major version is 1 and the minor version is 0. glxdino does not use glXQueryVersion but it may be useful for programs in the future.