You need to go through only three steps
- Download OpenGL C++ libraries.
- Setup and install eclipse CDT bundle.
- Configure the eclipse libraries [simple].
- Test OpenGL application.
Download OpenGL C++ dependencies
- In terminal use sudo apt-get install libglu1-mesa-dev freeglut3-dev
Setup and install eclipse CDT bundle
- In eclipse Help > Install New Software
- Add new cdt installation path http://download.eclipse.org/tools/cdt/releases/8.5
- Tick CDT Main Features hit next and finish the process and restart the eclipse
Configure the eclipse libraries [simple]
- In eclipse choose New > C++ Project
- Right click the project > Properties
- Select C/C++ Build > Settings > GCC C++ Linker > Libraries > +
- Add glut, GL, GLU libraries
- Time to test a OpenGL app
Test OpenGL application
- Download this sample source code [link]
- Right click on project New > File create new c or cpp file and paste the code
- Its best practice to always clean and build the cpp project to do that right click Clean Project, right click Build Project / ctrl+B
- Right click on project Run As > Local C/C++ program
- It should show a red 3d cube like this
- Fun [HACK] make the cube rotate
- Replace this code snippet inside void display(void) function
while (true) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); drawBox(); glutSwapBuffers(); glRotatef(1.0f, 1.0f, 1.0f, 1.0f); }