Anthony Stone wrote:
> I have now got my Fortran code that uses OpenGL to compile
> successfully, with a slightly hacked version of your OpenGL_Binding
> module, but I find that I am missing many of the interfaces.
Let me know what these hacks are if they are really needed.
> can attempt to generate them using Perl, as you suggested. Where is
> the best place to find the source files? Google throws up lots of
> sites offering source code for OpenGL applications, but I haven't
> found any that provide the sources for the actual OpenGL procedures. I
> need a few interfaces for glut routines too.
You mean you need the prototypes, not the sources?
The specs for the OpenGL (including GLU and GLUT) routines are at:
http://www.opengl.org/documentation/spec.html
There is an HTML for the 1.1 version and also man pages for all the
routines. Probably the best one would be to actually have a header file
with all the prototypes---the best place to look for that I think is the
SGI OpenSource site:
http://oss.sgi.com/projects/ogl-sample/index.html
Anybody have other ideas---the cleaner the header is (of material not
actually part of the OpenGL spec), the better.
Probably the best thing to do is to write a generic Perl script that
takes a C header file and converts it into a Fortran module. defines go
to parameters, prototypes to interfaces, typedefs I am not sure, depends
on context. The tricky part is deciding what to do with C pointers.
Sometimes they should convert to normal Fortran dummies, sometimes to
"TYPE(C_PTR), VALUE". In general, (void*)->"TYPE(C_PTR), VALUE". Also,
(some_typedef*)->"TYPE(C_PTR), VALUE", since those are usually handles
and don't actually need typing. Some human intervention might be needed.
Thanks a lot for doing this---it would be major help to everyone!
Eventually the converse (Fortran->C header) would be great too.
Aleks
|