Port GLUT to GLX


I work for a university and a project I am working on includes updating the libraries for the example OpenGL programs that will be used by a professor. GLX was recommended to me. I don’t know anything about OpenGL however, so if anyone has any idea how to port a program that uses GLUT to GLX (replacing the GLUT initialization fragment with the equivalent in GLX), any help would be appreciated.

Some of the programs include:


Why ? Would better port to freeglut.

Any reason why freeglut would be more long term term or better than GLX? In any case can someone point me in the direction to find how to port programs over from glut to either GLX or Freeglut?

…or is FreeGLUT backwards compatible? What’s trying to be avoided is using obsolete libraries.

reason freeglut is longer term : it is truly opensource. and has less bugs.
freeglut is a drop-in replacement of the original glut. most current linux distributions use it in place of the original glut.

Thanks for your help. I’m looking into porting the files to freeglut but am having some issues.

I originally include:

#include <stdlib.h>
#include <FL/glut.H>
#include <GL/glu.h>
#include <unistd.h>

for the square program. (link in first post)

I added:

#include <GL/freeglut.h>

and when I goto compile, the only error I am getting is

Compiling squareF.cxx…
squareF.cxx:6:25: error: FL/glut.H: No such file or directory
make: *** [squareF.o] Error 1

Is there a different “include” I should be using instead of FL/glut.h

I have no problems on the Solaris machines running GLUT.


FL ? This is not from glut, but from FLTK apparently. I don’t know much about this. You should be able to replace it by freeglut.h …

#include <FL/glut.H>

Hum, very nice, I love the ‘H’ in capital. :slight_smile:

On freeglut project website, they recommend to do this:

#include <GL/freeglut_ext.h>
#include <GL/glut.h>

And remove the FL/glut.H

I’m currently getting:

Linking squareF...
g++: unrecognized option '-R/usr/openwin/lib'
/usr/bin/ld: cannot find -lsocket
collect2: ld returned 1 exit status
make: *** [squareF] Error 1

as the problem. I have freeglut installed on this machine now.

Thanks again for the help.