How to run OpenGl Program in a Linux Machine

I just started to program in OpenGL. But i can’t find a way how to compile or run this program in a linux machine. Please Help me.

I suggest you download Mesa (, if you have already installed video driver for your hardware then you should not install Mesa itself, but it comes with lots of examples you can look at, you can also look at the make files for those examples to figure out how to compile OpenGL applications.

To put it simple, you need to include the GL/gl.h file and you also need to link with the OpenGL libraries (-lgl and so on).

You will also need some way to create the window to run OpenGL in, you can do this direct with X, glut, SDL, FOX, Qt and so on, glut and X examples are included with Mesa, Qt, SDL and FOX all comes with OpenGL examples, so it all depends on what you prefer.