SIGGRAPH '97

Course 24: OpenGL and Window System Integration

Graphics Library Transition Notes



Contents



1. Introduction

OpenGL is now the predominate 3-D graphics library and there are reasons to port many existing applications from older libraries: Porting graphics applications can take a lot of effort; there are no silver bullets. This document outlines several techniques and hints.



2. PEX to OpenGL

PEX is a 3-D graphics extension to the X Window System. The API is similar to Xlib in that there are many pointers, structures and complicated function calls. OpenGL by comparison is much cleaner and simpler. Feature-wise, PEX offers much of the functionality of OpenGL 1.0.

Here are the highlights of PEX vs OpenGL and porting:



3. IRIS GL to OpenGL

Since OpenGL's roots are in IRIS GL one may expect porting from IRIS GL to OpenGL to be easy. Conceptually, IRIS GL and OpenGL are very similar, but in practice porting is not an easy job. Many of the IRIS GL function calls directly map to OpenGL. On the other hand, many features such as lighting and texturing are implemented quite differently.

SGI's OpenGL Porting Guide is a good place to begin a porting project. The toogl utility partially automates the conversion of programs from IRIS GL to OpenGL. It is included with the IRIX IDO option.

Below are the highlights of the similarities and differences in OpenGL and IRIS GL.

3.1 Similarities

Basic Rendering
OpenGL and IRIS GL are very similar in how they specify geometric primitives; both use the begin/vertex/color/normal/end paradigm. In many cases, IRIS GL drawing commands directly map to OpenGL equivalents.

Transformation and viewing
OpenGL and IRIS GL use similar functions for coordinate transformation and viewing. Both have modelview and projection matrices which can be built up from simple transformation calls (scale, translate, rotate). Be aware that OpenGL's projection functions such as glOrtho() and glFrustum() are multiplied onto the projection matrix rather than replace the projection matrix as IRIS GL's ortho() and window() do. You should first load an identity matrix.
Immediate mode rendering and display lists
Immediate mode rendering and display list are supported by both libraries. OpenGL, however, does not support editing display lists as IRIS GL does. Nested/hierarchal OpenGL display lists may replace editing.
Picking and feedback
Picking (selection) works similar in OpenGL and IRIS GL; both use a name stack. Feedback in OpenGL is nicer than IRIS GL because OpenGL feedback is identical on all implementations, while IRIS GL implemented it differently on some systems.
Depth testing, blending, stenciling, accumulation
Depth (Z) buffering, alpha blending, stencil buffers and accumulation buffers are all implemented similarly in OpenGL and IRIS GL. In many cases there is a direct mapping of functions between the libraries.

2.2 Differences

OpenGL contains no window system functions like IRIS GL
If your IRIS GL program is a "mixed model" program, using IRIS GL for rendering but X for window/event handling, then most of your even processing code should work fine with OpenGL.

If your IRIS GL program makes heavy use of IRIS GL's input devices, window management, pop-up menus, etc porting will be more difficult. One possibility is to use GLUT. GLUT provides much of the IRIS GL functionality which OpenGL lacks.

Lighting
While OpenGL and IRIS GL lighting are functionally similar, the implementations are quite different. IRIS GL's lmdef() and lmbind() functions are replaced by separate functions for setting light, material, and lighting model parameters in OpenGL. The tables of IRIS GL lighting parameters one might be using can be replaced by display lists in OpenGL.
Texture mapping
IRIS GL supports defining tables of textures, one of which can be bound at a time with texbind(). OpenGL only directly supports one texture map definition at a time. However, the texture object extension or display lists can be used to simulate the IRIS GL texture system.
No subsetting of OpenGL
One especially nice difference between IRIS GL and OpenGL is the fact that OpenGL does not allow subsetting. That is, the entire functionality of OpenGL will always be implemented. IRIS GL unfortunately implemented different features on different systems.
These points only describe the high-level differences in the graphics libraries. As mentioned above, the OpenGL Porting Guide goes into much more detail.




Last edited on April 13, 1997 by Brian Paul.