PDA

View Full Version : Port GLUT to GLX



rkarolak
10-15-2008, 06:52 AM
Greetings,

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:
http://pastebin.com/f22abd61
http://pastebin.com/f5daebe49

Thanks

ZbuffeR
10-15-2008, 08:10 AM
Why ? Would better port to freeglut.

rkarolak
10-17-2008, 06:59 AM
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?

rkarolak
10-17-2008, 07:02 AM
..or is FreeGLUT backwards compatible? What's trying to be avoided is using obsolete libraries.

ZbuffeR
10-17-2008, 09:25 AM
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.
RTFM :
http://freeglut.sourceforge.net/

rkarolak
10-20-2008, 08:37 AM
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.

Thanks.

ZbuffeR
10-20-2008, 08:52 AM
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 ...

dletozeun
10-20-2008, 01:18 PM
#include <FL/glut.H>


Hum, very nice, I love the 'H' in capital. :)

On freeglut project website, they recommend to do this:



#ifdef FREEGLUT
#include <GL/freeglut_ext.h>
#else
#include <GL/glut.h>
#endif


And remove the FL/glut.H

rkarolak
10-24-2008, 07:45 AM
Ok,
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.