Stereoscopic Display Support in OpenGL


With the release of OpenGL version 1.1 specification, stereoscopic display support is readily programmable through APIs common to all graphics workstations. The same OpenGL APIs which support double buffering for real-time 3D rendering also support stereo quad buffering on stereo-ready systems. Identification of stereo-capable display modes is queried via glGetBooleanv() with GL_STEREO parameter.

Whereas double buffering assigns a visible front buffer and a non-visible back buffer, stereo quad buffering additionally assigns left and right buffer components. Instead of referring to the double buffers as GL_FRONT and GL_BACK, the stereo buffers are individually identified as GL_FRONT_LEFT and GL_FRONT_RIGHT, GL_BACK_LEFT, and GL_BACK_RIGHT. The underlying graphics hardware automatically alternates between the left and right front buffer displays. Typically the programmer selects only the left and right back buffers for drawing with glDrawBuffer(), and then updates the complete stereo pair with a system swap function, such as glXSwapBuffers() or glutSwapBuffers().

While OpenGL specifies system-independent functions for primative 3D rendering operations, system-specific functions like setting the display modes are deferred into separate libraries, like GLX for X-Windows, or GLUT for any compatible system. In GLX, a stereo display mode is requested by adding GLX_STEREO flag for glXChooseVisual(), which is then enabled by subsequent calls to glXCreateContext() and glXMakeCurrent(). In GLUT, the equivalent sequence of calls are handled by passing GLUT_STEREO flag to glutInitDisplayMode().

Under Microsoft Windows NT/9x, an equivalent set of WIN32 system APIs are available as counterparts to the GLX APIs: ChoosePixelFormat(), wglCreateContext(), and wglMakeCurrent(). A stereo display mode is requested by adding the PFD_STEREO flag to the OpenGL-specified Pixel Format Descriptor used in ChoosePixelFormat(). OpenGL graphics boards with mini client drivers for intercepting OpenGL calls with hardware support will be able to enable GL_STEREO quad buffering modes in the same manner.

For further information about OpenGL, the following reference textbooks are currently available from the OpenGL Architecture Review Board, published by Addison Wesley.

OpenGL Reference Manual, by the OpenGL Architecture Review Board, Renate Kempf and Chris Frazier, Editors.

OpenGL Programming Guide, by Jackie Neider, Tom Davis, and Mason Woo.

OpenGL Programming for the X-Windows System, by Mark J. Kilgard.

For information about OpenGL on Microsoft Windows NT/9x, refer to the WIN32 SDK included with all commercial C compilers supporting MS Windows platforms, and the OpenGL SDK available from the Microsoft Developer Network, MSDN.