OpenGL
Updated November 2024
Overview
Developed originally by Silicon Graphics Inc, OpenGL is a 2D/3D graphics library which is available on Windows, Linux and Mac.
OpenGL's main strengths are in the areas of 3 dimensional visualisation and animation. Winteracter
programs can utilise OpenGL in two different ways:
- Direct calls to OpenGL functions in the GL and GLU libraries (1.10), via a Fortran oriented calling interface derived from f90gl.
- Calls to Winteracter 3D modelling routines which provide a substantially simplified calling interface.
Winteracter's interface to OpenGL consists of three main components:
- A module called
OPENGL which provides a Fortran interface to the various OpenGL graphics routines. The routine names are the same as the C originals. Fortran 90 data types are also defined which are directly analagous to the C equivalents. Together, these simplify translation of C based OpenGL code to Fortran 9x/200x.
- A routine called
WglSelect which selects a target drawing surface for OpenGL output.
- Winteracter's own 3D modelling routines include an OpenGL-based renderer called
WglShow , providing OpenGL performance to programs which do not otherwise call OpenGL directly.
Winteracter includes OpenGL support on all of Windows, Linux and Mac.
Advantages
While other OpenGL interfaces exist for use from Fortran based applications, the Winteracter OpenGL interface offers some significant advantages:
- OpenGL graphics can be routed to a window, memory bitmap or dialog field.
- OpenGL images can be printed via
WglPrintImage or saved to bit image files via WglSaveImage .
- The full range of menu types (horizontal menu bar, toolbar and floating menus are all available).
- All the other Winteracter facilities are simultaneously available, combining state of the art 3D graphics, with extensive user-interface and scientific graph plotting capabilities.
- Text handling has been added (see below).
- When used with the Winteracter 3D modelling routines, model descriptions can be saved to or loaded from disk, in either a proprietary binary format or standard DXF, STL or OBJ formats.
- The OpenGL renderer provided with the Winteracter 3D modelling routines, provides a "best of both worlds" solution. Developers who are unfamiliar with OpenGL or who are uncomfortable with the C orientation of most OpenGL training material, can still gain access to OpenGL performance.
|
Text Handling
Since OpenGL provides no text output facilities as standard,
Winteracter includes a set of text support
routines which are closely modelled on its own graphics text handling facilities.
These OpenGL text support functions provide access to any True Type font under Windows
and to a handful of built-in software-based vector fonts on all supported platforms.
|
Documentation and Examples
When calling OpenGL functions directly, a suitable reference book or online programming guide is recommended.
However, since most of the available reference material is C oriented, the supplied documentation includes brief
Fortran oriented descriptions of all of the supported OpenGL functions. A selection of example programs are also
included to illustrate use of OpenGL in Winteracter-based applications.
3D Model Viewer
An OpenGL-based 3D model viewer called 3Dview
is included among Winteracter's
visual tools.
3Dview provides a highly responsive display of model files created by the
Winteracter 3D modelling routines.
It can also display many 3D models created by third party applications in DXF, STL or OBJ format.
The model viewer can be redistributed with Winteracter
based applications.
|
|
Acknowledgements
OpenGL® is a trademark of Hewlett Packard Enterprise.
The OPENGL module included with Winteracter is a
derivation of f90gl, the official Fortran 90 OpenGL interface written by
William F. Mitchell of the Mathematical and Computational Sciences Division,
National Institute of Standards and Technology, Gaithersburg, MD 20899, USA.
The Winteracter implementation of the OpenGL interface differs from f90gl in several ways:
- The internal Fortran/C calling interfaces were revised to ensure their correct operation with all the Windows Fortran compilers supported by Winteracter.
- The GLUT interface is omitted, since this is not required in Winteracter based programs.
- The multiple modules in the f90gl interface were consolidated into a single module. It is only necessary to add a single
USE OPENGL statement per program unit to gain access to all the OpenGL routines and data types.
- The additional object code libraries which accompany the f90gl interface are subsumed in the Winteracter library in Windows implementations, thereby simplifying the linking procedure. The X Windows version provides a single separate
libwintGL.a OpenGL support library.
- Support for implementation-specific OpenGL extension routines can optionally be built into f90gl via a series of preprocessor switches. However, since this involves rebuilding the interface for each target OpenGL implementation (which in turn requires a C compiler) this support was omitted from the Winteracter OpenGL interface.
Further Information
A great deal of information and sample code is available on the World Wide Web relating to OpenGL. The official
OpenGL web site provides extensive links to relevant material.
|