OpenGL interface in Allegro CL 8.0 (added 08/22/06) [update]

This is an update to the binding of the OpenGL foreign function definitions by the current SWIG version 1.3.30. Older bindings will continue to work, and users should be able to upgrade to these new bindings with little or no changes to code.

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, to OpenGL 1.2 and OpenGL 1.3 on Linux, and OpenGL 2.0 on Mac OS X (ppc or x86). 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, Linux, and Mac OS X (ppc or x86) at this time.

Users wishing to port the OpenGL bindings to other platforms can use the platform specific examples in opengl.i to add new ports. The build rules in the Makefile show sample SWIG invocations. Users are referred to the Allegro CL specific section of SWIG for documentation on Allegro CL specific command-line arguments and their uses.

Since the update OpenGL bindings were generated after the Allegro CL 8.0 release, we have made them available as a patch. You must first run sys:update-allegro to download these files (after the update, you should see updated files in opengl/, opengl/win32-1.1/, opengl/linux-1.3/, and opengl/macosx-2.0).

Once you have updated your system, you can use the interface on Windows, Linux, and Mac OS X (ppc or x86).

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.2 rather than 1.3.

The Mac OS X version uses GLUT to manage the windows in which the drawing occurs. See opengl/readme.txt for details on running the example on Mac OS X.

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 © 2014 Franz Inc., All Rights Reserved | Privacy Statement
Delicious Google Buzz Twitter Google+