Scientific Computing & Visualization
Help Contact
About Accounts Computation Visualization Documentation Services

OpenGL Basics

Description

The OpenGL (Open Graphics Library) was originally developed by SGI to be a more 'open' (portable) version of their early SGI GL Graphics Library. Utilities in the OpenGL graphics library can be called from C programs and include functions for generating objects made up of points, lines and polygons. Once objects are generated, OpenGL has routines for rendering them with control over lighting, object surface properties, transparency, anti-aliasing and texture mapping. Window management is not supported in the basic version of OpenGL but there are additional libraries built on top of OpenGL which you can use for many of the things which OpenGL itself does not support.
Highlights: Fast on SGIs, as it uses their graphics hardware. Eventually, it should be ported to most other systems and be able to use other architectures' graphics capabilities. Users must deal with the local window manager or use OpenGL extensions.

Availability and Setup

You can utilize the OpenGL graphics library of routines by making calls to the routines from C programs. In order to utilize the OpenGL library, you will need to #include <GL/gl.h> in your program. All OpenGL library functions begin with the letters gl and capitalize words (example functions: glClear and glClearColor and glVertex2f).

Using OpenGL

OpenGL is by default an immediate-mode rendering system. This means that if you make a call to draw an object, it will immediately be drawn, as opposed to some systems which store calls until you tell them to actually execute the stored drawing calls.

There are several additional modules/extensions to OpenGL which may be available to you. These include:
OpenGL Utility Library (GLU)
The GLU is included with OpenGL and built using low-level OpenGL commands. It contains routines for setting up viewing and projection matrices, polygonal tesselation and surface rendering. GLU routines begin with the prefix glu.
OpenGL Extension to the X Window System (GLX)
OpenGL does not include any routines for handling windowing operations so the GLX was developed to fill this gap with regard to the X Window System. Using GLX, you can readily make your OpenGL programs do drawing to a drawable window under the X Window System. GLX may be available on your system and GLX routines begin with the prefix glx.
OpenInventor
OpenInventor is an object-oriented toolkit based on OpenGL. OpenInventor includes an even model for user interaction and various pre-defined objects and high-level routines which can be used to create and modify three-dimensional scenes. OpenInventor routines are also available for printing and graphics format conversion.
Getting started with OpenGL
OpenGL examples and toolkits are located under /usr/share/OpenGL. Before compiling any of the example programs, take a quick look at /usr/share/OpenGL/README.

Under IRIX 6.2, the examples which correspond with those described in the OpenGL Programmer's Guide reside in /usr/share/src/OpenGL/book/red_book_92.

OpenGL requires the programmer to deal with the windowing system, which in our environment means the X window system. You may do this in a variety of ways. You may use straight X code, with the glx extensions provided by SGI for making OpenGL calls to X windows. You may also use one of several toolkits to avoid dealing with the myriad of details required to work at the X level. The two toolkits which will be mentioned here are the AUX toolkit and the GLUT toolkit.

For examples of writing glx code, you can look at /usr/share/src/OpenGL/teach/glx_based/tess.c or at the source code for the toolkits described below.

The AUX routines are used by the OpenGL Programmer's Guide examples. The libraries are installed as /usr/share/src/OpenGL/toolkits/lib/libaux.a, /usr/share/src/OpenGL/toolkits/lib32/libaux.a, /usr/share/src/OpenGL/toolkits/lib64/libaux.a, (O32, N32, N64 formats, respectively). The include file is /usr/share/src/OpenGL/toolkits/include/aux.h. If you want to look at the source for these, look in /usr/share/src/OpenGL/toolkits/libaux and /usr/share/src/OpenGL/toolkits/libtk.

Another popular alternative is the GLUT Graphics Library Utility Toolkit. You can look here for an introduction, online documentation, and to download the source. We have the postscript version of the documentation online in /usr/share/GLUT. Examples may be found in /usr/share/src/OpenGL/teach/glut_based. The libraries are installed as /usr/lib/libglut.a, /usr/lib32/libglut.a, /usr/lib64/libglut.a (O32, N32, N64 formats, respectively). The include files are in /usr/include/GL.

Additional Help/Documentation

What hardcopy documentation we have is available in the Computer Graphics Lab (Room 203, 111 Cummington Street, lab hours and access). The most useful hardcopy manual for learning OpenGL is the OpenGL Programming Guide, written by Jackie Neider, Tom Davis and Mason Woo. Source code for the examples given in that book can be found in the directory /usr/local/examples/OpenGL/book.

Online, the most useful place to visit for OpenGL information is SGI's OpenGL WWW Center.


Document Name: opengl
Author/Maintainer: Aaron D. Fuegi (aarondf@bu.edu)
Libraries: /usr/lib/libGL.so, /usr/lib/libGLF.so, /usr/lib/libGLFexec.so, /usr/lib/libGLU.so, /usr/lib/libGLcore.so, /usr/lib/libGLw.a
Other Files: /usr/include/GL/, /usr/local/examples/OpenGL/book/
Keywords: opengl, open, graphics, language, library, inventor
Machines List: IBM p690, IBM p655, CGL Cluster
Created August 10, 1995; Last Revised August 31, 1995; Last Modified 17:31 17-May-06
URL of this document: http://scv.bu.edu/Graphics/opengl.html
Go up to SCV Help Pages
Boston University
Boston University
 
OIT | CCS | September 21, 2007  
Scientific Computing & Visualization Boston University home page Boston University home page