fglIntro(3G) OpenGL Reference fglIntro(3G)NAME
- Introduction to OpenGL FORTRAN Bindings
OVERVIEW
OpenGL is a high-performance 3D-oriented renderer that supersedes IrisGL.
It is supported on all SGI graphics adaptors except for the G, GT and
GTX. A number of other workstation and personal computer vendors also
support OpenGL.
This manpage contains OpenGL FORTRAN binding specific information.
NOTES
The FORTRAN bindings naming convention for routines is to prefix each
OpenGL call with fgl. GL_ prefix is used for the constants.
The OpenGL FORTRAN bindings header files consist of /usr/include/GL/fgl.h
and /usr/include/GL/fglu.h, the OpenGL FORTRAN bindings libraries are
/usr/lib/libfGL.a and /usr/lib/libfGLU.a.
There are no FORTRAN bindings for X and GLX.
To determine if a pointer is null, compare it to GL_NULL (which is
actually an 8-character string).
Beware of problems with the commands that return strings of potentially
unlimited length, such as fglGetString. The FORTRAN bindings support only
limited length strings. If you need to deal with longer strings, you will
need to write an interface routine that copies the result string into a
buffer and then returns a token at a time.
EXAMPLES
Compile with f77 -o sphere sphere.f -lfglut -lfGLU -lfGL -lglut -lGLU
-lGL -lXmu -lXext -lXi -lX11
C GLUT Fortran program to draw red light sphere.
subroutine display #include "GL/fgl.h"
call fglclear(GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT)
call fglcalllist(1)
call glutswapbuffers
end
subroutine gfxinit #include "GL/fgl.h"
real diffuse(4),pos(4)
data diffuse /1.0, 0.0, 0.0, 1.0/
data pos /1.0, 1.0, 1.0, 0.0/
call fglnewlist(1, GL_COMPILE)
call glutsolidsphere(dble(1.0), 20, 20)
Page 1
fglIntro(3G) OpenGL Reference fglIntro(3G)
call fglendlist
call fgllightfv(GL_LIGHT0, GL_DIFFUSE, diffuse)
call fgllightfv(GL_LIGHT0, GL_POSITION, pos)
call fglenable(GL_LIGHTING)
call fglenable(GL_LIGHT0)
call fglenable(GL_DEPTH_TEST)
call fglmatrixmode(GL_PROJECTION)
call fgluperspective(dble(40.0), dble(1.0),
2 dble(1.0), dble(10.0))
call fglmatrixmode(GL_MODELVIEW)
call fglulookat(dble(0.0), dble(0.0), dble(5.0),
2 dble(0.0), dble(0.0), dble(0.0),
3 dble(0.0), dble(1.0), dble(1.0))
call fgltranslatef(0.0, 0.0, -1.0)
end
program main #include "GL/fglut.h"
external display
external reshape
external submenu
external mainmenu
call glutinit
call glutinitdisplaymode(GLUT_DOUBLE+GLUT_RGB+GLUT_DEPTH)
call glutcreatewindow('Fortran GLUT sphere')
call gfxinit
call glutdisplayfunc(display)
call glutmainloop
end
BUGS
OpenGL FORTRAN bindings may contain unresolved symbols. Adding
-ignore_unresolved to your compile command line will eliminate the error.
SEE ALSO
glIntro
Page 2