Appendix D. GLUT Compatibility

Table of Contents
Using the GLUT Compatibility Header File
Known Problems
Mixing GLUT and FLTK Code
class Fl_Glut_Window

This appendix describes the GLUT compatibility header file supplied with FLTK.

Using the GLUT Compatibility Header File

You should be able to compile existing GLUT source code by including <FL/glut.H> instead of <GL/glut.h>. This can be done by editing the source, by changing the -I switches to the compiler, or by providing a symbolic link from GL/glut.h to FL/glut.H.

All files calling GLUT procedures must be compiled with C++. You may have to alter them slightly to get them to compile without warnings, and you may have to rename them to get make to use the C++ compiler.

You must link with the FLTK library. If you call any GLUT drawing functions that FLTK does not emulate (glutExtensionsSupported() , glutWire*(), glutSolid*(), and glutStroke*() ), you will also have to link with the GLUT library (after the FLTK library!)

Most of FL/glut.H is inline functions. You should take a look at it (and maybe at test/glpuzzle.cxx in the FLTK source) if you are having trouble porting your GLUT program.

This has been tested with most of the demo programs that come with the GLUT 3.3 distribution.