This directory contains source code from a three-part series of articles published in The X Journal about programming OpenGL and X. Included in each article is a complete program that is also reproduced here in compilable form. This source can be found in the sgigate.sgi.com:~ftp/pub/opengl/xjournal subtree.
The documents linked into this page hail from the documents/OpenGL directory -- if you wish to download more than one of the PostScript files at the same time, you'll need to go to that directory to "make it so". The Makefile for the following programs indicates what libraries are needed for each.
The OpenGL graphics system is a high-performance, window system independent 2D and 3D graphics interface. The technology was developed by Silicon Graphics and is now controlled by the OpenGL Architecture Review Board. OpenGL's GLX extension integrates OpenGL with the X Window System. This article describes OpenGL's functionality and how it is used with X. A simple OpenGL program using Xlib is presented. OpenGL is compared and contrasted with PEX, a 3D graphics interface designed specifically for X. The two subsequent articles in this series describe how to integrate OpenGL with Xlib and Motif programs.
glxsimple.c A very simple OpenGL program rendering a cube which can be rotated using buttons presses. The program demonstrates creating a window for use with OpenGL, hidden surface removal, and double buffering. This program is presented in the first article in the November/December issue.
This is the second article in a three-part series about using the OpenGL(tm) graphics system and the X Window System. A moderately complex OpenGL program for X is presented. Depth Buffering, back-face culling, lighting, display list modeling, polygon tessellation, double buffering, and shading are all demonstrated. The program adheres to proper X conventions for colormap sharing, window manager communication, command line argument processing, and event processing. After the example, advanced X and OpenGL issues are discussed including minimizing colormap flashing, handling overlays, using fonts, and performing animation. The last article in this series discussess integrating OpenGL with the Motif toolkit.
glxdino.c A moderately complex OpenGL program that renders a 3D dinosaur which can be rotated with mouse input. The program demonstrates colormap sharing, proper set up of X window manager properties, maintaining window aspect ratios, back-face culling, double buffering, display list modeling, polygon tesselation, hidden surface removal, shading, lighting, and X event processing. This program is presented in the second article in the January/February issue.
The OpenGL(tm) graphics system can be integrated with the industry-standard OSF/Motif user interface. This article discusses how to use OpenGL within a Motif application program. There are two approaches to using OpenGL with Motif. One is to render into a standard Motif drawing area widget, but this requires each application window to use a single visual for its window hierarchy. A better approach is to use the special OpenGL drawing area widget allowing windows used for OpenGL rendering to pick freely an appropriate visual without affecting the visual choice for other widgets. An example program demonstrates both approaches. The X Toolkit's work procedure mechanism animates the example's 3D paper airplanes. Handling OpenGL errors is also explained.
paperplane.c A toy Motif program which draws 3D paperplanes flying in figure-eights on a sky background. The program demonstrates both how to use the OpenGL- specific Motif widget and how to use the standard Motif drawing area widget. Motif pull down menus to implement the GUI controls for the program. Work procs handle the animal. This program is presented in the third article in the July/August issue.
glxmotif.c A program demonstrating how to use OpenGL with Motif (not using a special OpenGL widget). Work procs are used for animation. Press "s" to stop and start spinning the polygons; the arrow keys rotate the scene manually. This program is presented in the third article in the March/April issue. This program does not appear in any of the three articles, but appeared on the last Toolbox and appears here for completeness.These programs will operate on an IRIS 4D machine running IRIX 5.1 or later.