View Full Version : Installing OpenGL for programming

12th October 2004, 07:57 PM
Does anybody know the most painless way to install OpenGL so that I can program with it. I have got the nvidia OpenGL graphics driver installed (using yum). So now I am looking for a way to start using OpenGL in my c,c++ programs. I am very new to linux and FC2, but would really appreciate any help on how to set up my developement environment.

12th October 2004, 08:16 PM
A simple test is to use the command
to see if the openGL extensions are present in the X server.
If the extensions are present, just write a simple c program that uses openGL and try to compile it. That will reveal any problems with missing libraries etc.

12th October 2004, 08:25 PM
Hmm, I ran it and this was the output:

[fesh@server fesh]$ glxinfo
name of display: :0.0
Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".
Error: couldn't find RGB GLX visual

visual x bf lv rg d st colorbuffer ax dp st accumbuffer ms cav
id dep cl sp sz l ci b ro r g b a bf th cl r g b a ns b eat
Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".
0x21 24 tc 1 0 0 c . . 0 0 0 0 0 0 0 0 0 0 0 0 0 None
Xlib: extension "GLX" missing on display ":0.0".
Xlib: extension "GLX" missing on display ":0.0".
0x22 24 dc 1 0 0 c . . 0 0 0 0 0 0 0 0 0 0 0 0 0 None
Segmentation fault
[fesh@server fesh]$

This seems like it is bad. Can anyone help with this?

12th October 2004, 08:26 PM
On second thought, does this mean the nvidia OpenGL display driver is not correctly installed?

12th October 2004, 08:33 PM
It seems that glx is missing. You can find details how to unistall Nvidia driver with 3D support enabled on http://www.fedorafaq.org/#nvidia . That assumes you won't have to change the kernel in a future other than bug fixes.

12th October 2004, 08:40 PM
So you are saying I should uninstall the driver and re-install it?

12th October 2004, 08:45 PM
Depending how you installed the driver (rpm or official NVidia method), I suggest to reinstall it.

12th October 2004, 08:45 PM
I don't know if loading the drivers fixes the xorg.conf file to use openGl. One thing to try is to look in your /etc/X11/xorg.conf file and see if you have something in the modules section like:

Section "Module"
Load "glx"

or if the Load "glx" line is commented out with a '#'. Uncomment the line or put it in. Then reboot (or restart the X server). Try glxinfo again.

12th October 2004, 09:17 PM
Ok, after taking a look at my xorg.conf file, the line Load "glx" is in there. Here is the listing under "Module"

Section "Module"
Load "dbe"
Load "extmod"
Load "fbdevhw"
Load "glx"
Load "record"
Load "freetype"
Load "type1"
Load "dri"

However the line that is supposed to be changed from "nv" to "nvidia" in

Section "Device"
Identifier "Videocard0"
Driver "nv"
VendorName "Videocard vendor"
BoardName "NVIDIA GeForce 3"

Keeps changing back to "nv" everytime i change it to "nvidia" after a reboot. This is perplexing, because that means the yum method of installing an nvidia driver apparently didn't work. Which sucks, so i'll probably try to install the official nvidia driver package after trying to undo all the damage i did with yum. Then I guess I can come back to the problem at hand which was setting up the developement environment. Any other help you could offer would be greatly appreciated, thx for helping me thus far.

12th October 2004, 09:37 PM
It's suprising to me that something changes your xorg.conf file while rebooting. How are you editing the file? Are you sure your changes "took" before you rebooted?

It's also strange that glxinfo says you don't have the GLX extensions but xorg.conf says to load them. Look in /var/log/Xorg.0.log and see if it reports some error about loading the glx module.

12th October 2004, 11:40 PM
I had the same issue with livna Nvidia rpm until I remove it. I suspect it is this package that causes the problem as I removed it and install the official Nvidia package instead. I use kernel-source 2.6.5 and it seems the livna rpm package is optimized for kernel 2.6.7 and above that uses kernel-sourcecode.

13th October 2004, 08:13 AM
Well, after completely re-formatting and re-installing Fedora Core 2, this is what I did ( like to start with a clean slate )

As root, I
Downloaded the newest driver file from nvidia's website
Folllowed the instructions in the driver file readme (exiting x, installing driver, editing xorg.conf , etc.)

Ok cool, at this point openGL drivers were kicken, I played chromium to test them out and it ran great.

By downloading the nvidia openGL driver and successfully installing it, GL.h and GLU.h and respective lib files were acquired.

But how was I supposed to get the almighty GLUT?? Well, turns out yum works pretty good for some things, this is one of those cases. As root, at the command line just type "yum install freeglut-devel" this will install freeglut developer package which contains glut.h and appropriate libs. So at this point you have all the necessary headers and libs. Most Excellent :)

One more thing, please please please! Don't forget to use the command line switch "-lglut" when you run gcc or else your nifty new openGL app won't link right. I must have bashed my head on the keyboard for 3 hours trying to figure out why my source files would compile fine but then when it came time to link everything and build the executable it kept giving me an "undefined reference" error for every glut/gl call that was made. Just use "-lglut" to tell it you are using the glut library and it should compile and link up no problem.

Eg: $ gcc -lglut src.cpp -o src.exe

Anyways, thats what I did, hopefully this will be helpful to somebody who is having similar issues. Thanks to tashirosgt and Finalzone for the feedback.