04.10.10 - Installing OpenGL/Glut libraries in Ubuntu
Steps to install, link and run OpenGL/Glut programs in Ubuntu
The first step is to install the development libraries of OpenGL/Glut in Ubuntu:For newer versions of Ubuntu (>= 11.10) you have to install another package because the linker does't link anymore.Create a test file (test.c):Compile the file linking the OpenGL/Glut libraries:
sudo apt-get install freeglut3 freeglut3-dev
sudo apt-get install binutils-gold
#include <GL/glut.h>
//Drawing funciton
void draw(void)
{
//Background color
glClearColor(0,1,0,1);
glClear(GL_COLOR_BUFFER_BIT );
//Draw order
glFlush();
}
//Main program
int main(int argc, char **argv)
{
glutInit(&argc, argv);
//Simple buffer
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB );
glutInitWindowPosition(50,25);
glutInitWindowSize(500,250);
glutCreateWindow("Green window");
//Call to the drawing function
glutDisplayFunc(draw);
glutMainLoop();
return 0;
}
//Drawing funciton
void draw(void)
{
//Background color
glClearColor(0,1,0,1);
glClear(GL_COLOR_BUFFER_BIT );
//Draw order
glFlush();
}
//Main program
int main(int argc, char **argv)
{
glutInit(&argc, argv);
//Simple buffer
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB );
glutInitWindowPosition(50,25);
glutInitWindowSize(500,250);
glutCreateWindow("Green window");
//Call to the drawing function
glutDisplayFunc(draw);
glutMainLoop();
return 0;
}
gcc -lGL -lglut test.c -o test
Via: Ubuntuforums

Hi Thanks for the great information on OpenGL in Ubuntu. Very helpful. (The black background in your text boxes is not good though with black text as it is difficult to see/read it! A different colour combo would help!). I like your site - thanks & best wishes
The next version of kiwwito (comming soon) will change the black background. Thanks again for the advice.
Unfortunately: something is wrong with the ubuntu glut library: it doesn't link properly anymore!
I keep getting E: Invalid operation binutils-gold I'm also getting undefined reference for all of the gl commands I try to use.
use "sudo apt-get install binutils-gold". Missing install.