OpenGL interface in Allegro CL 7.0 (added 12/13/04)

OpenGL is a collection of 2D and 3D graphics routines providing an environment for developing portable, interactive 2D and 3D graphics applications (see www.opengl.org). Allegro CL now has an interface to OpenGL 1.1 on Windows and to OpenGL 1.2 and OpenGL 1.3 on Linux. The interface was built using SWIG -- see Allegro CL support in SWIG. The SWIG-generated files are available and will likely work on other UNIX platforms, but we have not tested them on anything other than Windows and Linux at this time.

Certain files needed for the OpenGL interface were unavailable at the time of the release of Allegro CL 7.0 so to use the interface, you must first run sys:update-allegro to download these files (after the update, you should see the new directories opengl/win32-1.1/, opengl/linux-1.2/, and opengl/linux-1.3/).

Once you have updated your system, you can use the interface on Windows and Linux.

On Windows, the CGGL Common Graphics veneer on OpenGL allows you to draw OpenGL graphics on any Common Graphics window or other Common Graphics stream. CGGL itself has a very small API that lets you establish a Common Graphics stream as the current OpenGL drawing destination. Then you can insert pure OpenGL code into redisplay-window methods to do the actual drawing. You can also add methods to event-handling generic functions like mouse-left-down and virtual-key-down, just as you would for any other Common Graphics window, except you use OpenGL code for operations like rotating the image.

There is a Common Graphics/OpenGL example which can be run by starting Allegro CL and the IDE and then loading the example code and evaluating (red-teapot):

(load "sys:opengl;cggl;load.cl")

(red-teapot)

The result is the following picture being displayed, showing a 3D image of a red teapot:

rtp.jpg (10237 bytes)

Using the down arrow key, the teapot can be rotated, as this image shows:

rtp1.jpg (10501 bytes)

The LINUX version works with a GTK veneer. A similar demo is available on Linux. See opengl/readme.txt for details on running the example on Linux and for information about using OpenGL 1.3 rather than 1.2.

There is more information on the Windows/OpenGL Common Graphics veneer in the documentation in opengl/cggl/doc.txt and on the Linux/OpenGL GTK veneer at opengl/gtkgl/doc.txt

Copyright © 2023 Franz Inc., All Rights Reserved | Privacy Statement Twitter