Lahey/Fujitsu Fortran

OpenGL Graphics Libraries

OpenGL is a software interface for applications to generate interactive 2D and 3D computer graphics independent of operating system and hardware operations. It is essentially a 2D/3D graphics library which was originally developed by Silicon Graphics with the goal of creating an efficient, platform-independent interface for graphical applications (Note: OpenGL is a trademark of Silicon Graphics Inc.). It is available on many Win32 and Unix systems, and is strong on 3D visualization and animation.

f90gl is a public domain implementation of the official Fortran 90 bindings for OpenGL, consisting of a set of libraries and modules that define the function interfaces. The f90gl interface was developed by William F. Mitchell of the Mathematical and Computational Sciences Division, National Institute of Standards and Technology, Gaithersburg, in the USA. For information on f90gl, see the f90gl web page at:

Until recently, the OpenGL LF9x applications could only be built as statically linked applications targeted for Visual C. A much friendlier method is now available thanks to a porting effort implemented by Lawson B. Wakefield of Interactive Software Services Ltd. in the UK. (ISS are the developers of the INTERACTER & Winteracter GUI/graphics Fortran development tools). This implementation has made the OpenGL interface available within the framework of the WiSK and Winteracter libraries, and has been performed on a voluntary, non commercial basis. The Lahey LF95 f90gl interface therefore has the same non copyrighted status as the NIST original. A full set of examples is available under the WISK directory of the LF95 installation.

OpenGL Libraries

To use f90gl/OpenGL you will need the following OpenGL DLL's installed in your Windows SYSTEM or SYSTEM32 directory:

The first two of these libraries are a standard part of Windows NT4, 2000, XP, 95(OSR2), 98 and Me. Windows 95 release 1 users must upgrade to one of these releases. Many video card manufacturers now also provide accelerated OpenGL support as part of their video drivers. These drivers may replace the functionality of these two DLL's. GLUT32.DLL is not part of the standard Windows distribution. GLUT32.DLL will be installed in the System or System32 (NT) directory by the installation program.

f90gl Libraries and Modules

The following f90gl libraries and modules should be installed in LF95's LIB directory:

These files will be installed when LF95 is installed.

Building OpenGL programs

Compilation and linking of f90gl programs simply requires that the LF95 LIB directory be specified in the compiler module path and that the names of the f90gl libraries are specified for linking. Specify -win to create a Windows program. See the RUNDEMOS.BAT file for command line examples. These are substantially simplified from the somewhat complex MF8N?O.BAT equivalents supplied with the f90gl distribution.


LF95 blender.f90 -win @gllibs.rsp Where gllibs.rsp contains -mod \lf9557\lib f90gl.lib f90glu.lib f90glut.lib glut32.lib glu32.lib opengl32.lib

Sample Programs

A subset of the f90gl examples are supplied in the LF95 EXAMPLES directory. A makefile is included to build and run all of the examples.

Example programs:

  • Blender - two rotating objects, one red, one green, which fade in and out, plus some text.
  • Fbitfont - some text
  • Fscene - three 3D objects in red. The right mouse button brings up a menu. Redraw is really slow in outline mode on some machines.
  • Logo - the f90gl logo. Rotate with the mouse while holding the left mouse button. Right mouse button brings up a menu. Middle mouse button selects a new value on the color bars (rgb sliders).
  • Modview - contains a module for using the mouse and arrow keys to rotate, zoom, pan and scale. Initially the left button rotates (hold button down while moving mouse), middle button zoom, arrow keys pan, and right button brings up a menu.
  • Olympic - the olympic rings come flying into position. Restart the animation with the space bar; terminate with escape.
  • Plotfunc - plots a function of two variables as contours, a surface mesh, or a solid surface. Uses the modview module. Right button brings up a menu.
  • Scube - a rotating cube in front of a background. Right mouse button brings up a menu. There are also keyboard keys for the same functions as on the menu (look for keyboard in the source code).
  • Sphere - a red sphere.
  • Sources of Information

    General inquiries and bug reports regarding f90gl should be sent to:

    Lahey specific issues should be directed to:

    OpenGL information can be found at: