GLUT Fortran users, BUILD INSTRUCTIONS =================== To build the GLUT Fortran API, do the following: 1) Make sure you are running IRIX 5.3, 6.1, or 6.2 or higher. 2) Make sure you have Fortran compilers and OpenGL Fortran libraries installed (make sure you have the right support installed for the "object style" you wish to build). The following Fortran subsystems are particularly important to have installed: ftn77_dev.sw.util -- utiles for building Fortran to C bindings gl_dev.sw.fortran -- OpenGL Fortran binding libraries 3) Run "mkmkfiles.sgi" in this directory. 4) Make sure you have built the "lib/glut" and "lib/fglut" directories: (cd lib/glut; make) (cd lib/fglut; make) 5) Change to one of the GLUT Fortran library directories, depending on what "object style" you wish to build: O32 (old 32-bit ABI) - "cd lib/fglut" N64 (new 64-bit ABI) - "cd lib/fglut.n64" (IRIX 6.1 & 6.2 only) N32 (new 32-bit ABI) - "cd lib/fglut.n32" (IRIX 6.2 only) (If you are building a given "object style", make sure you build the accompanying GLUT library implementation. See README.irix6) 6) Execute "make" in the directory. NOTES ====== All GLUT functionality is available through the GLUT Fortran API. A number of example GLUT Fortran examples are built in the directory as examples of how to write GLUT Fortran programs. There are a number of caveats to using the GLUT Fortran API: o The GLUT Fortran API is not built by default. See the build instructions above. You will need the IRIX Fortran development option installed. o The implementation of the GLUT Fortran API is probably only useful to IRIX users because the generation of Fortran-to-C wrappers is inherently dependent on vendor-dependent calling convention dependencies. o The IRIX GLUT Fortran API is implemented as a set of wrappers to to the GLUT C implementation. As such, there is a very slight overhead to calling OpenGL routine through the GLUT Fortran binding (this applies to the OpenGL Fortran wrapper routines as well). o The ARB's official OpenGL Fortran API prefixes every routine and constant with the letter F. The justification was to avoid name space collisions with the C names. Nearly all modern Fortran compilers avoid these name space clashes via other means (underbar suffixing of Fortran routines is used by most Unix Fortran compilers). The GLUT Fortran API does _not_ use such prefixing conventions because of the documentation and coding confusion introduced by such prefixes. Bending over backwards to support anachronistic compliers does not justify this confusion. While the official OpenGL Fortran API, prefixes both routine and constant names, there is no technical justification for prefixing constant names. In practice, it creates a reasonable amount of coding and documentation confusion (the confusion is heightened by Fortran's default implicit variable initialization so you don't realize the lack of a constant prefix until run-time) and pushes names one character towards identifier limits. The GLUT distribution supplies its own version of "GL/fgl.h" and "GL/fglu.h" which does not F-prefix constants. GLUT users are encouraged to not use the F-prefixed constants. (The GLUT supplied "GL/fgl.h" also works around problems discussed in the next bullet.) Perhaps the OpenGL ARB will reconsider the F-prefix or (as an unfortunate compromise) support both F prefixed and non F prefixed constant names. o A OpenGL Fortran API implementation was released with IRIX 5.3 (it was not previously available in IRIX). While the Fortran wrappers work, there are a number of difficulties with using the IRIX 5.3 OpenGL Fortran bindings: + Make sure you have the "Fortran 77 OpenGL Graphic Library" subsystem installed. Its name is: ftn_dev.sw.opengl + The OpenGL Fortran man pages incorrectly document a number of calls taking REAL*4 (real) parameters when they in fact require REAL*8 (double precision) parameters. An example is fglviewport. Any OpenGL (or GLU) routine that takes double's as parameters in the C API, takes REAL*8's in the Fortran API. Be very careful to use the dble intrinsic whenever passing non-REAL*8 values to such routines! + The OpenGL Fortran man pages also do not add the F-prefixes to constants discussed in the man pages. Because GLUT supplies a "GL/fgl.h" without F-prefixes, this should be a "good thing." + The "GL/fgl.h" header file describing the OpenGL Fortran API contains identifiers over 32 characters long. While the MIPS Fortran compiler should treat this as a soft warning and truncate the identifiers to 32 characters, the compiler generates a fatal error. For this reason, the "GL/fgl.h" in this distribution has truncated by hand the "GL/fgl.h" identifiers over 32 characters to 32 characters. o IRIX 6.2's OpenGL Fortran binding was quite bungled and is basically unusable. A workaround for this problem is to compile your OpenGL Fortran programs with the compiler option "-Wl,-ignore_unresolved". This tells the compiler to ignore unresolved symbols. Then, when you run the OpenGL Fortran binaries, tell the run-time linker (rld) to ignore unresolved symbols like this: setenv _RLD_ARGS -ignore_unresolved SGI patches 1892 (IRIX 6.3 and 6.4 OpenGL Fortran bindings) and 2360 (IRIX 6.2 OpenGL Fortran bindings) should fix problems in the OpenGL Fortran binding library. o Because GLUT fonts are compiled into programs and programs should only have the fonts compiled into them that they use, GLUT font names like GLUT_BITMAP_TIMES_ROMAN_24 are really symbols so the linker should only pull in used fonts. Unfortunately, if a data symbol is declared EXTERNAL, the IRIX Fortran compiler pulls in the symbol whether the symbol is used or not. For this reason, "GL/fglut.h" does not explictly declare EXTERNAL the GLUT font symbols. GLUT Fortran programmers should explicitly declare EXTERNAL the GLUT fonts they use. o Neither the MicroUI (mui) or Tubing and Extrusion library (gle) have Fortran bindings. INSTALLATION ============= If you want to install the resulting archives into the right system library directories, do the following: FOR N32: cp lib/fglut.n32/libfglut.a /usr/lib32 FOR N64: cp lib/fglut.n64/libfglut.a /usr/lib64 Also, make sure to install the GLUT library implementation versions for the given object style too. - Mark Kilgard