based on work by Anthony Stone, Aleksandar Donev and the original f90 open GL binding by William F.
Mitchell.

What I did is document the F2003 openGL binding with diagrams below, made small code changes to make
build with F2008 and build the examples in it as static to make it easier for someone to download and run
without having to have openGL installed on their Linux. This was done for Linux only not for windows. Below
is more description of my changes to the binding.

The executables of the examples are in the above zip ﬁle. I added .exe to the names just to make it more
clear. These are linux executables, not windows.

1.2 description

This describes how to use 2003 opengl with Fortran and few examples I wrote using this API as I learning
openGL. First a description of the build structure is given. This is the description based on my own layout of
the oﬃcial binding obtained from http://www-stone.ch.cam.ac.uk/pub/f03gl/index.xhtml

I have made small changes to the ﬁle naming (mixed case changed to all lower case) since it is less
confusing this way, as Fortran is case insensitive and now the ﬁle names and the module names all
match.

In addition, I broke one module ﬁle into 2 ﬁles so that there is 1-1 correspondence with ﬁle name and
module name.

Some code changes are made to the binding ﬁles to make them build with std=f2008.

The description below reﬂects what I have in the above zip ﬁle not the original and oﬃcial Fortran 2003
openGL binding.

There are now 4 Fortran ﬁles that make up the Fortran 2003 binding, and one C ﬁle. They
are

In the above diagram, the client program main.f90 needs to link to the above 4 object ﬁles generated from the 4
Fortran ﬁles, and against the object ﬁle generated from the one C ﬁle glut_fonts.o

The above shows the object ﬁles that needs to be linked against. In addition, one needs to link to the opengl
and glut and X libraries of course. For static linking, other libraries are needed. Diagram below shows all
libraries needed, and a script is including below to do that.

The diagram below shows everything that is needed to compile and link against.

This assumes a Linux 32 bit system. This is based on Linux mint 32 bit. On diﬀerent Linux distributions or
on 64 bit, the tree will can and will look a little diﬀerent depending on the distribution.

To compile the C ﬁle glut_fonts.c the ﬁle GL/glut.h is needed.

In the diagram below it is assumed that main.f90 is located in your own folder, say $HOME/src and that the
Fortran opengl binding ﬁles are located in $HOME/fortran_opengl.

The following diagram shows all the ﬁles needed to build an executable as shared or static. This is the
layout on Linux 32 bit (Linux Mint 13)

This table includes the examples from the oﬃcial openGL fortran 2003 binding build statically
on Linux. Each example has a screen shot and link to the source code and the executable. You
can download the executable to Linux and run it. Hopefully it will run as is since it is statically
linked.

I added .exe extension to the executable since some browsers have a bug in them where the ﬁle will be
corrupted during download if it is binary but does not have .exe extension. This was the case using Firefox on
linux.

To download the .exe, do SAVE AS and save it on your Linux ﬁle system, then run it as you would run any
executable on linux.

All of these executables are in the above zip ﬁle. So if you downloaded the zip ﬁle, these are in there
already.

6 my Fortran cheat sheet notes

ldd -- shows what libraries a program linked to nm -- shows what symbols in the shared library of object file and type of symbol reference for the kind data http://docs.oracle.com/cd/E19059-01/stud.10/819-0492/4_f95.html compile options to use gfortran -Wextra -Wall -pedantic -fcheck=all -fcheck=do -fwhole-file -fcheck=pointer-O2 -funroll-loops -ftree-vectorize -Wsurprising -Wconversion I am getting >gcc -I/usr/include -c glut_fonts.c In file included from /usr/include/features.h:389:0, from /usr/include/inttypes.h:26, from /usr/include/GL/glext.h:5386, from /usr/include/GL/gl.h:2085, from /usr/include/GL/freeglut_std.h:120, from /usr/include/GL/glut.h:17, from glut_fonts.c:1: /usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory compilation terminated. I do not know how this happend, but /usr/include/gnu/stubs-32.h was missing. So I copied one from different distributions and now it works. To find which file comes from which dep package see http://www.debian.org/distrib/packages#search_contents to find which file comes from which RPM package see static link note ------------------- 2.7 Influencing the linking step These options come into play when the compiler links object files into an executable output file. They are meaningless if the compiler is not doing a link step. -static-libgfortran On systems that provide libgfortran as a shared and a static library, this option forces the use of the static version. If no shared version of libgfortran was built when the compiler was configured, this option has no effect. getting link error when doing static missing __gxx_personality_v0