GLUT

Hello again,

First of all, thanks for the help guys. Sure enough the openGL libraries were on my system already and by changing the #include <"gl/ to "GL/ all compiled good and well without even the need for the includes for linking includes so I now have an empty source file with 2 includes! Right, onto my next question.

So off i went looking for OpenGL programming examples for Linux… i found plenty windows examples straight away and after a little more searching i found one which had source for linux! Now I try and compile the C sourcecode with gcc and up comes my second problem: the sourcecode relies heavily on the GLUT libraries.

After a little research I found out that the GLUT is a common libarary for handling windowing functions and input, etc, and downloaded the glut libraries (glut-3.6.tar.gz). After reading the install instructions and following them carefully I get a problem when I come to running the Makefile (the last step). It complains about the following missing Mesa libraries:

  • libMesaGL.so, and
  • libMesaGLU.so

Now, I understand that Mesa is an implementation of the OpenGL libraries but I really don’t want to use them because the hope is that eventually the linux code will be compiled on a windows machine again and that either operating systems can be used so cross-platform is a priority. So I want to stick with OpenGL and I want to use GLUT to keep porting simple.

Can anyone please help me with this ‘getting started’ problem. I know these are quite fundamental things but everyone needs to start somewhere!

Thanks for any help,

Graham

Yes GLUT is a cross platform windowing API for openGL, note you must have the library build for the target system.

Example: Nate Robins has the windows version of the library on his site and keeps it up to date.

When I was playing with linux, I can not remember where I got it, but there is a prebuilt libglut.a file for linux and the gcc compiler.

What type of linux are you running?
Version of gcc? I was sure the glut came with the newest release.

This site has some tip’s that maybe will help you on building the GLUT library.

The following website say’s to change the following:

  • libMesaGL.so
  • libMesaGLU.so

TO

Originally posted by GrahamP:
[b]Hello again,

First of all, thanks for the help guys. Sure enough the openGL libraries were on my system already and by changing the #include <"gl/ to "GL/ all compiled good and well without even the need for the includes for linking includes so I now have an empty source file with 2 includes! Right, onto my next question.

So off i went looking for OpenGL programming examples for Linux… i found plenty windows examples straight away and after a little more searching i found one which had source for linux! Now I try and compile the C sourcecode with gcc and up comes my second problem: the sourcecode relies heavily on the GLUT libraries.

After a little research I found out that the GLUT is a common libarary for handling windowing functions and input, etc, and downloaded the glut libraries (glut-3.6.tar.gz). After reading the install instructions and following them carefully I get a problem when I come to running the Makefile (the last step). It complains about the following missing Mesa libraries:

  • libMesaGL.so, and
  • libMesaGLU.so

Now, I understand that Mesa is an implementation of the OpenGL libraries but I really don’t want to use them because the hope is that eventually the linux code will be compiled on a windows machine again and that either operating systems can be used so cross-platform is a priority. So I want to stick with OpenGL and I want to use GLUT to keep porting simple.

Can anyone please help me with this ‘getting started’ problem. I know these are quite fundamental things but everyone needs to start somewhere!

Thanks for any help,

Graham[/b]

Okay, all this seems a little complicated for what im actually trying to do. all i need is the compiled glut libraries and headers so that i can write GL/GLUT apps, right? the make fails when i go back upto the glut-3.6 directory and run make and it tries to make the examples.

so can i not just take the ‘libglut.so’ that i built and all these header files and chuck them somewhere where the compiler will find them?

the OpenGL ‘.so*’ files are in /usr/lib so can’t i just chuck the libglut.so* files in there? and the openGL headers are in /usr/include/GL/ so cant i just shove the header files for the GLUT libraries in /usr/include/GL? or maybe /usr/include/GLUT? and if so which ones do i need?

or am i missing something obvious that means this gameplan wont work?

graham

I have never compiled the glut library from scratch, so can not help you too much their.

You do not have to compile the glut library in order to write a glut program, I would first try and find a precompiled version for you gcc.

Try google srearch of ‘libglut.a gcc linux’

Originally posted by GrahamP:
[b]Okay, all this seems a little complicated for what im actually trying to do. all i need is the compiled glut libraries and headers so that i can write GL/GLUT apps, right? the make fails when i go back upto the glut-3.6 directory and run make and it tries to make the examples.

so can i not just take the ‘libglut.so’ that i built and all these header files and chuck them somewhere where the compiler will find them?

the OpenGL ‘.so*’ files are in /usr/lib so can’t i just chuck the libglut.so* files in there? and the openGL headers are in /usr/include/GL/ so cant i just shove the header files for the GLUT libraries in /usr/include/GL? or maybe /usr/include/GLUT? and if so which ones do i need?

or am i missing something obvious that means this gameplan wont work?

graham[/b]

thanks for your help and advice so far. this is where im upto:

i tried the originally suggested URL with compiling and installing GLUT. The example was for installing glut-3.7 (not a release version?) and i had 3.6 so i stuck with 3.6 so as not to make matters anymore confusing. i followed the instructions and all compiled well with the exception of the examples.

now, i tried looking around on the internet for the precompiled libglut.a file but to no avail so i tried to use the one i compiled from the glut-3.6 source.

for reference, here’s some info about my development platform:

  • im using redhat linux 8.0,

  • gcc version 3.2

  • the glut package i used was definitely the linux source.

  • i have the following files in the following directories:

    /usr/lib/libglut.a
    /usr/lib/libglut.so
    /usr/lib/libglut.so.3
    /usr/lib/libglut.so.3.6
    /usr/include/GL/glut.h
    /usr/lib/libgle.a
    /usr/lib/libmui.a

i tried to compile the example code with the following command:

gcc lesson1.c -lGL -lGLU -lglut

and i get the following linking errors:

/usr/lib/gcc-lib/i386-redhat-linux/3.2/…/…/…/libglut.so: undefined reference to __glutDetermineMesaSwapHackSupport' /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libglut.so: undefined reference toXGetExtensionVersion’
/usr/lib/gcc-lib/i386-redhat-linux/3.2/…/…/…/libglut.so: undefined reference to XFreeDeviceList' /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libglut.so: undefined reference toXQueryDeviceState’
/usr/lib/gcc-lib/i386-redhat-linux/3.2/…/…/…/libglut.so: undefined reference to XListInputDevices' /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libglut.so: undefined reference to__glutMesaSwapHackSupport’
/usr/lib/gcc-lib/i386-redhat-linux/3.2/…/…/…/libglut.so: undefined reference to XFreeDeviceState' /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libglut.so: undefined reference toXOpenDevice’
/usr/lib/gcc-lib/i386-redhat-linux/3.2/…/…/…/libglut.so: undefined reference to XmuLookupStandardColormap' /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libglut.so: undefined reference toXSelectExtensionEvent’

any ideas what on earth im doing wrong? sorry to be so stupid!

graham

I don’t know, but here’s my guess.
Install the mesa libraries, and put the -lmesa (or whatever) on the gcc line. The makefile can be platform-dependent. without making the source platform-dependent. That’s just the way this platform’s glut library is built.
-r

If you have the libglut.a library file that is all you need along with the headers.

But you also may need to include the x-windows librarys in your linker settings. I think some of the errors are because of that.
Maybe a mesa library is needed also…

That is what I think the error are from.

I have been wanting to reinstall linux back on a partition of my large hard drive, so I could get back into doing some linux openGL work…but does not want to boot from the partition I have setup. Something to do with a limitation of where the boot area has to be.

Originally posted by GrahamP:
[b]thanks for your help and advice so far. this is where im upto:

i tried the originally suggested URL with compiling and installing GLUT. The example was for installing glut-3.7 (not a release version?) and i had 3.6 so i stuck with 3.6 so as not to make matters anymore confusing. i followed the instructions and all compiled well with the exception of the examples.

now, i tried looking around on the internet for the precompiled libglut.a file but to no avail so i tried to use the one i compiled from the glut-3.6 source.

for reference, here’s some info about my development platform:

  • im using redhat linux 8.0,
  • gcc version 3.2
  • the glut package i used was definitely the linux source.
  • i have the following files in the following directories:
/usr/lib/libglut.a
/usr/lib/libglut.so
/usr/lib/libglut.so.3
/usr/lib/libglut.so.3.6
/usr/include/GL/glut.h
/usr/lib/libgle.a
/usr/lib/libmui.a

i tried to compile the example code with the following command:

gcc lesson1.c -lGL -lGLU -lglut

and i get the following linking errors:

/usr/lib/gcc-lib/i386-redhat-linux/3.2/…/…/…/libglut.so: undefined reference to __glutDetermineMesaSwapHackSupport' /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libglut.so: undefined reference to XGetExtensionVersion’
/usr/lib/gcc-lib/i386-redhat-linux/3.2/…/…/…/libglut.so: undefined reference to XFreeDeviceList' /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libglut.so: undefined reference to XQueryDeviceState’
/usr/lib/gcc-lib/i386-redhat-linux/3.2/…/…/…/libglut.so: undefined reference to XListInputDevices' /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libglut.so: undefined reference to __glutMesaSwapHackSupport’
/usr/lib/gcc-lib/i386-redhat-linux/3.2/…/…/…/libglut.so: undefined reference to XFreeDeviceState' /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libglut.so: undefined reference to XOpenDevice’
/usr/lib/gcc-lib/i386-redhat-linux/3.2/…/…/…/libglut.so: undefined reference to XmuLookupStandardColormap' /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../libglut.so: undefined reference to XSelectExtensionEvent’

any ideas what on earth im doing wrong? sorry to be so stupid!

graham[/b]