Checking if OpenGL is installed on my linux

excuse me for the question,
but i understand this forum is for beginners:
i have recently installed FEDORA core 3,
and i would like to know if OpenGL is installed with the OS.
how do i do that?
and if it’s not there, how do i get it?

It should be installed by default if X is installed. If you look in /usr/X11R6/lib and use ls command you should see sever shared library files. If you see them they are installed. Also, if you have an NVIDIA video card you can download the Linux drivers and it will install nvidia specific OpenGL libraries and headers. Not sure about ATI as I believe it uses the DRI interface and may use the standard X OpenGL libs and headers (never owned or used an ATI card).

As a test you can run the command


and if it runs then OpenGL is working properly.

You can also use the command


to find info about your GLX support and what your card supports.


  • - Simple Quad program


#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <stdlib.h>

void quad()
glVertex2f( 0.0f, 1.0f); // Top Left
glVertex2f( 1.0f, 1.0f); // Top Right
glVertex2f( 1.0f, 0.0f); // Bottom Right
glVertex2f( 0.0f, 0.0f); // Bottom Left

void draw()
// Make background colour black
glClearColor( 0, 0, 0, 0 );

    // Push the matrix stack - more on this later

    // Set drawing colour to blue
    glColor3f( 0, 0, 1 );

    // Move the shape to middle of the window
    // More on this later
    glTranslatef(-0.5, -0.5, 0.0);

    // Call our Quad Method

    // Pop the Matrix

    // display it 


// Keyboard method to allow ESC key to quit
void keyboard(unsigned char key,int x,int y)
if(key==27) exit(0);

int main(int argc, char **argv)
// Double Buffered RGB display
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
// Set window size
glutInitWindowSize( 500,500 );
// Declare the display and keyboard functions
// Start the Main Loop

try with this example

for compile

cc quad.c -lglut


a.out or ./a.out

fedora core3 having GLUT don’t worry about u try some program what i gave ,

if its not working GLUT
with this command u find GLUT
insert core3 cd’s(1,2,3 &4) one by one
ls | grep -i glut

copy GLUT rpm file to your Hard disk
install GLUT File

rpm -ich <file name.rmp>

sorry for command 2)

write one is

rpm -ivh <file.rpm>

I’m trying to get openGL working on RH9. Thanks
to all for your contributions. I get the glxgears
shinpaughp has said to look for but trying Karthik’s
sample code results in compilation
errors such as:

/tmp/ccKuM0ZH.o/(.text+0xc): In function ‘quad’:
: undefined reference to ‘glBegin’

I added /usr/include/ to the path in my .bashrc
and then to the #include lines in Karthik’s code
with no change.
Am I leaving out other files needing inclusion?
Perhaps files associated with X11?
Thanks in advance for your help.
All the best.

In your makefile/compiler command did you use -L/usr/X11R6/lib (or -L/usr/lib/ if you are using the libraries from NVIDIA drivers) as well as -lGL to link the OpenGL library to your program. Also, the include should be through the Makefile/compiler command using the -I option such as -I/usr/include (or /usr/share/doc/NVIDIA_GLX-1.0/include if you are using the headers from NVIDIA drivers).

Hope that helps.

hi Atli, sample program is working in Red hart 8 & Fedora Core 3 also i don’t have exp in red hart 9.

for compile which command u used?

try this command

cc quad.c -lglut -lGLU -lGL -lm

Thanks so much for the responses. They led me in
the right direction. I did some other looking around and found a posting on
(available through google->groups) that had a superset of your advice that worked. The posting suggested: (from Marko Mihovilic)

g++ -Wall -I/usr/X11R6/include/ -o ps -L/usr/X11R6/lib ps.o
-lX11 -lXi -lXmu -lglut -lGL -lGLU -lm

(where “ps” must be the preferred name of the object/executable, -W specifies warnings).

After playing around with it, I found the minimum library linkages required for Karthic’s code to be:

g++ -I/usr/X11R6/include/ -L/usr/X11R6/lib -lXi -lXmu -lglut -lGL -lGLU -lm

I confess to some confusion here since using the “locate” command shows me that:
X11, Xi, and Xmu are within /usr/X11R6/lib, nevertheless I needed explicit linkages to them (except X11, for this case) in order to compile and run.
Thanks again, shinpaughp and karthic; I can move on now.
All the best.

At the command line: glxinfo

glxinfo says “Xlib: extension “GLX” missing on display “:0.0”.”, though I have /usr/X11R6/lib/… What do I do?

:eek: well, the problem was about uncommenting “Load “glx”” in /etc/X11/XF86Config

How do I know what version of opengl api I am using?
glxinfo? at the line “Opengl version string” ?

Isn’t there a package somewhere that I can install opengl 2.0? I know it shouldn’t be ‘glut’ package, but… well… I’m very confused.


Originally posted by <confused>:
How do I know what version of opengl api I am using?
glxinfo? at the line “Opengl version string” ?

Yup, that’s the point.

Isn’t there a package somewhere that I can install opengl 2.0? I know it shouldn’t be ‘glut’ package, but… well… I’m very confused.

There are no 2.0 drivers yet. But pretty much all the functionality is available via extensions, so it’s not really a problem.

Thank you!
$ gcc quad.c -lglut -lGLU -lGL -lm

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.