OpenGL-linux is a project mainly written in C++, it's free.
a hello-world type OpenGL program written in C++ and using freeglut
This is a simple, introductory OpenGL program.
This is a slightly modified version of the file posed on Oasis as "wk1" on the CMT2319 course's page. The only soruce code modification is that this file includes different headers - other differences include only comments and code style.
Compiling this file on linux is surprisingly easy.
First, you need to make sure you have the following stuff on your system:
If you don't have the headers or lib's, you can get them by installing freeglut - type 'sudo apt-get install freeglut-dev' at the command line. g++ can be installed by this command: 'sudo apt-get install g++'
Second, we need to tell the compiler where to find the headers and the lib's. On Linux, g++ first looks for header files in "/usr/include". The headers we need are in the "/usr/include/GL" folder - therefore, #include <GL/glut.h>. Libraries are specified by passig command line arguments to the compiler. This simple example needs code from glut and GLU libraries - we tell this to the compiler by specifying '-lglut' and '-lGLU' as arguments.
Also, it's recommended to give the executable the compiler generates a meaningfull name - such as "hello"( by default, the compiler will name executables "a.out" ). We do this by using another command line argument: '-o hello'
We end up with the following command: g++ -o hello wk1_linux.cpp -lglut -lGLU ( I'm assuming the file you're trying to complie is called "wk1_linux.cpp" and it's in the current directory. )
After executing it, you should have a brand new file named "hello". You can run the file by entering "./hello" at the command line.