Advanced Graphics Using OpenGL
OpenGL is a library of graphic functions that create
sophisticated graphic displays such as 3-D images and animation. OpenGL is
commonly available on workstations. Writing to this standard allows your
program to be ported easily to other platforms.
OpenGL windows are used independently of and in
addition to any console, QuickWin and regular Windows windows your application
uses. Every window in OpenGL uses a pixel format, and the pixels carry, among
other things, RGB values, opacity values, and depth values so that pixels with
a small depth (shallow) overwrite deeper pixels. The basic steps in creating
OpenGL applications are:
- Specify the pixel format
- Specify how the pixels will be rendered on the video device
- Call OpenGL commands
OpenGL programming is straightforward, but requires a
particular initialization and order, like other software tools. References to
get you started are:
- The OpenGL Reference Manual, Addison-Wesley, ISBN 0-201-46140-4.
- The OpenGL Programming Guide, Addison-Wesley, ISBN 0-201-46138-2.
- OpenGL SuperBible: The Complete Guide to OpenGL Programming on Windows NT and Windows 95, Richard Wright and Michael Sweet, Waite Group Press (Division of Sams Publishing), 1996, ISBN 1-57169-073-5.
- OpenGL documentation in the Platform SDK title in HTML Help Viewer.
- The OpenGL description from the Microsoft Visual C++ manuals.
Microsoft no longer provides the glAux procedures.
Intel Visual Fortran provides an OpenGL module,
IFOPNGL.MOD, invoked with the
USE
statement line:
USE IFOPNGL
When you use this module, all constants and
interfaces that bind Fortran to the OpenGL routines become available. Any link
libraries required to link with an OpenGL program are automatically searched if
USE IFOPNGL
is present in your Fortran
program.
An OpenGL window can be opened from a console,
Windows, or QuickWin application. The OpenGL window uses OpenGL calls
exclusively, not normal Graphic Device Interface (GDI) calls. Likewise, OpenGL
calls cannot be made within an ordinary Windows window or QuickWin child
window, because special initialization is required for OpenGL calls.
The Fortran OpenGL identifiers are the same as the C
identifiers (such as using a GL_ prefix for constants), except that the gl
prefix is changed to fgl for routines and identifier lengths are limited to 31
characters . The data types in the OpenGL C binding are translated to Fortran
types as shown in the following table:
OpenGL/C Type
| Fortran Data Type
|
---|---|
GLbyte
| INTEGER(1)
|
GLshort
| INTEGER(2)
|
GLint, GLsizei
| INTEGER(4)
|
GLfloat, GLclampf
| REAL(4)
|
GLdouble, GLclampd
| REAL(8)
|
GLubyte
| INTEGER(1)
|
GLboolean
| INTEGER(1)
|
GLushort
| INTEGER(2)
|
GLuint, GLenum, GLbitfield
| INTEGER(4)
|
GLvoid
| INTEGER(INT_PTR_KIND())
|
pointers
| INTEGER(INT_PTR_KIND())
|
If you include (
USE
) the parameter constant definitions from
IFOPNGLT.F90
(such
as by
USE IFOPNGL
), you can
use the constants to specify the kind type, such as
INTEGER(K_GLint)
instead
of
INTEGER(4)
.