OpenGL headers

Hi, I need help setting up OpenGL for linux. I installed my Nvidia drivers and tested them out with glxgears and glxinfo. Now I wrote a small opengl application and when I go to compile it with gcc and I get errors that I’m missing the GL.h header file. This is what I type to compile:
gcc main.c -lGL -o GLTest

so my question is where is the actual header files and what am I doing wrong. shouldn’t I be able to compile OpenGL programs with my Hardware instead of using Mesa3D?

ugh Nevermind. I found the headers in the nvidia docs folder. Thanks anyway. :slight_smile:

It doesn’t matter whose headers you compile with or whose libGL.so you link with. At run-time the loader picks a libGL.so and uses it. If it picks the Nvidia one, you’ll get hardware acclerated goodness. If it pics the software Mesa one, you’ll get slowness. You can figure out which is going to be used by doing ‘ldd a.out’ (where a.out is the name of the program).

The header is not GL.h… you need to:

#include /usr/include/GL/gl.h

in your code. The problem is not the library path, -lGL should work fine, as it will be in /usr/lib, or /usr/lib64 if you are using the nvidia 64bit driver and a 64bit OS.

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