SIGGRAPH '97

Course 24: OpenGL and Window System Integration

OpenGL GUI and Graphics Toolkits



Contents



1. Introduction

A 3-D graphics application has two important components: the graphics library and user interface toolkit. While choosing OpenGL as the graphics library may be an easy choice, the decision of which GUI toolkit to use is not.

A number of factors influence the toolkit selection:

This document presents a survey of toolkit options for the OpenGL application programmer. For each toolkit the following attributes are discussed:

2. Low-level OpenGL interfaces

2.1 GLX and Xlib

Overview
GLX is the OpenGL extension to X. It provides the "glue" functions for integrating OpenGL with the X window system in C or C++. GLX is also the protocol which allows remote display of OpenGL on X suitable X servers. While Xlib is not a user interface toolkit, it is a means of integrating OpenGL into an X application.
OpenGL integration method
Functions are provided to select OpenGL-enhanced visuals, create rendering contexts, bind contexts to X windows, synchronize with X, swap color buffers, etc.
Appropriate uses
Any X-based application may use the GLX interface. Toolkits build on X such as Xt/Motif and GLUT are built on top of GLX and hide its details.
Advantages
  • Low level: complete access to unique facilities of the hardware (stereo, overlay planes, multi-sampling, etc)
  • It's the standard low level X/OpenGL interface.
Disadvantages
  • Low level: does not provide GUI elements such as menus and buttons
  • limited to X-based (and usually Unix-based) systems
  • requires considerable Xlib knowledge
References:

2.2 AGL, PGL and WGL (GLX-like) interfaces

Overview
There are OpenGL glue libraries for other window systems such as IBM's Presentation Manager (PGL), Macintosh (AGL), and Microsoft Windows (WGL for NT and '95). These interfaces are similar to GLX in functionality and API design. Function bindings are typically only availabe for C and C++.
OpenGL integration method
Again, functions are provided to select visual/pixel formats, create/bind rendering contexts, synchronize with the window system, swap color buffers, etc.
Appropriate uses
These low level interfaces are often needed for any OpenGL application on a PC or Mac since higher level toolkits don't encapsulate them. Caveat: There is an effort among OS/2 developers to write a PGL wrapper for PM.
Advantages
  • provide access to all OpenGL/window system integration features (off-screen rendering, font handling, etc.)
Disadvantages
  • requires knowledge of details specific to the window system
References


3. GUI toolkits with OpenGL support


3.1 Xt/Motif

Overview
Xt is the X Toolkit Instrinsics, a library built on Xlib designed to support user interface toolkits. Motif is a popular widget set built on Xt. Xt and Motif may be used with C/C++.
OpenGL integration method
The special GLwMDrawingArea widget supports OpenGL rendering. The IRIS ViewKit library provides a framework which offers an OpenGL widget as well.
Appropriate uses
Commercial, professional applications for the X environment.
Advantages
  • Motif is standardized and full featured.
  • Other widget sets are available: Athena, OPEN LOOK.
Disadvantages
  • Xt/Motif is large and complicated
  • Probably overkill for small applications
  • Motif is not free
References

3.2 GLUT

Overview
The GL Utility Toolkit, written by Mark Kilgard, is a free, portable toolkit which provides functions for creating windows, pop-up menus, event handling, drawing simple geometric primitives and much more.

GLUT will replace aux in the next edition of the OpenGL Programming Guide.

OpenGL integration method
GLUT is built on top of OpenGL and the underlying window system. It has a simple C/C++ API. Simply make GLUT calls to create windows and setup event handling then make OpenGL calls to draw your imagery.
Appropriate uses
  • applications which don't require a sophisticated GUI
  • teaching, instruction, experimentation
  • demos
Advantages
  • free
  • simple
  • portable; operating system and window system independent. Available for Xlib, Windows '95/NT, and OS/2.
  • provides access to advanced input devices, stereo viewing, overlay planes, etc
  • the GLUT source code provides excellent examples of programming advanced OpenGL and window system features.
Disadvantages
  • doesn't provide the user interface elements such as buttons and sliders needed for many applications
References

3.3 aux/tk

Overview
aux and tk (not to be confused with Tcl/Tk) are simple OpenGL toolkits developed by SGI for the OpenGL Programming Guide (first edition) and for OpenGL demos. They are very similar to each other, often only different in function prefixes. The major features of aux/tk are window creation and event handling.

These toolkits are very limited in functionality and are not intended for any sort of application development. The GLUT toolkit does everything that aux/tk does plus much more and should be prefered over aux/tk in any situation.

OpenGL integration method
tk is built on top of Xlib/GLX. aux has been implemented on several window systems and in the case of X, implemented on top of tk.
Appropriate uses
Small demo programs and examples from the OpenGL programming guide. GLUT is a much better choice.
Advantages
  • small and simple
  • aux is available on several operating systems
Disadvantages
  • very limited funtionality
  • several different API implementations of aux exist
  • has no features which GLUT doesn't also provide
References
  • OpenGL Programming Guide (first edition) from Addison-Wesley
  • A README documentat is included with most implementations

3.4 Tcl/Tk

Overview
Tcl is a popular, free, interpreted "script" language invented by John Ousterhout. Tk is a graphics user interface toolkit for Tcl. Tcl/Tk handles user interface and event processing while C is used for computation and rendering. Originally designed for X, both are now available for Windows and Macintosh systems.
OpenGL integration method
  1. A number of free OpenGL/Tk widgets are available which allow one to create OpenGL "canvases" from Tk. Rendering is done from C code calling the OpenGL API.
  2. Another approach taken by several people is to provide Tcl/Tk wrappers for all OpenGL function so an application may be written with Tcl/Tk alone.
Appropriate uses
  • Good for demos through large applications.
  • Good for experimentation, learning and small programs.
Advantages
  • Free
  • Easy to learn
  • Full featured GUI
  • Quick prototyping
  • Tcl/Tk applications are portable across Unix, Windows, and Mac.
  • hides low level details of GUI/OpenGL integration
Disadvantages
  • Since Tcl is interpreted it may not meet the demands of high performance applications.
References

3.5 XForms

Overview
XForms is a free X-based GUI toolkit written by T. C. Zhao based on the original Forms library by Mark Overmars.
OpenGL Integration method
A special OpenGL canvas can be created for OpenGL rendering.
Appropriate use
Small to large applications and demos.
Advantages
  • Free
  • Easy to use
  • Available for most Unix/X workstations
Disadvantages
  • OpenGL integration is minimal, one would have to modify the OpenGL canvas code if you need anything more than double buffered RGB rendering.
  • May not be as powerful as Motif
References

3.6 V

Overview
V is a cross-platform (X and Windows) C++-based GUI toolkit developed by Dr. Bruce Wampler at the University of New Mexico.
OpenGL Integration method
A special OpenGL canvas widget can be created for OpenGL rendering.
Appropriate use
Small to large applications.
Advantages
  • Free
  • Cross-platform
Disadvantages
  • OpenGL canvas constructor only allows basic control over selecting the OpenGL visual attributes.
References

3.7 Qt

Overview
Qt is a cross-platform (X and Windows) C++-based GUI toolkit from the company Troll Tech.
OpenGL Integration method
A special OpenGL widget can be created for OpenGL rendering.
Appropriate use
Small to large applications.
Advantages
  • Free and commercial licenses
  • Cross-platform
Disadvantages
References

3.8 MET++

Overview
MET++ is an extension to the ET++ Application Framework, an object-oriented class library that integrates interface building blocks, basic data structures, input/output, printing, and high-level application framework components. The MET++ extensions include OpenGL, GL, and PEX support. (http://www.ifi.unizh.ch/groups/mml/projects/met++/met++.html)


4. Graphics toolkits built on OpenGL


4.1 Inventor

Overview
A high-level 3-D graphics toolkit for C and C++ built on top of OpenGL. Inventor provides object-oriented database construction, rendering, interaction, file I/O, etc.
OpenGL Integration method
Inventor provides library functions for creating OpenGL- rendering windows. However, lower level window system integration (Xt) is also allowed.
Appropriate uses
Interactive, "object"-oriented graphical applications, possibly in conjuction with a GUI toolkit such as Motif.
Advantages
  • provides powerful high-level graphics structures and interaction
  • object/model file I/O
  • now available on many platforms from vendors such as Template Graphics Software and Portable Graphics
Disadvantages
  • not free
  • doesn't in itself provide all the GUI elements needed for full applications
References

4.2 Performer

Overview
A high-level graphics library built on top of OpenGL designed for high-performance realtime applications such as virtual reality, visual simulation, entertainment. C/C++ language bindings.
OpenGL integration method
Performer 2.0 is built on OpenGL. It also privides a simple set of window management routines (pfWindow).
Appropriate uses
Applications which require maximum interactive performance.
Advantages
  • provides high-level graphics structures, interaction, multi-CPU support, scene (LOD) management
  • object description file I/O
Disadvantages
  • Proprietary
  • Targeted to high-end hardware
  • doesn't provide GUI elements
References

4.3 OpenGL++ / OpenGL Scene Graph

Overview
At the time of this writing, OpenGL++ (aka the OpenGL Scene Graph) is under development by the OpenGL ARB. The purpose of OpenGL++ is to provide a higher-level toolkit for OpenGL which manages a scene graph with facilities for interaction, compilation, culling, multi-processing, sorting, etc.
OpenGL integration method
OpenGL++ will likely have C++ and Java APIs built upon OpenGL (or possibly other low-level 3-D APIs).
Appropriate uses
OpenGL++, like Open Inventor or Performer, will be appropriate for applications which require higher-level functionality than what OpenGL provides.
Advantages
  • Will relieve the application programmer of low-level OpenGL concerns.
  • Will provide high-level 3-D features such as scene-graph management, interaction, culling, LOD management, etc.
Disadvantages
  • May not be available for some time.
References

4.4 OpenGL Optimizer

Overview
The OpenGL Optimizer is a toolkit built on top of OpenGL. It's designed for CAD/CAE and visualization applications which deal with large, complex models. The OpenGL Optimizer offers advanced culling, occlusion testing and NURBS tesselation features.
OpenGL integration method
The OpenGL Optimizer is a C++ toolkit layered upon OpenGL.
Appropriate uses
Applications which deal with large, complicated object models can use the OpenGL Optimizer to simplify their models for faster interactive rendering.
Advantages
  • provides performance advantages over straight OpenGL rendering
  • adopted as a standard among CAD/CAE vendors/developers
Disadvantages
  • The OpenGL Optimizer is a very new product and may not be widely available at this time.
References

4.5 DirectModel

Overview
DirectModel from HP is similar to the OpenGL Optimizer. It provides a number of technologies which allow interactive visualization of very complex 3-D models.
OpenGL integration method
DirectModel is a toolkit which may be layered upon OpenGL or other low-level graphics libraries.
References


4. Miscellaneous

Steven Baum maintains a nice list of free
GUI development systems (http://www-ocean.tamu.edu/~baum/graphics-GUI.html) and graphics/visualization software (http://www-ocean.tamu.edu/~baum/ocean_graphics.html) at Texas A&M University.




Last edited on July 21, 1997 by Brian Paul.