Http://jingyan.baidu.com/article/c74d60007d104f0f6b595d6d.html
Sample program:
#include <GL/glut.h>#include<stdlib.h>voidinit ();voiddisplay ();intMainintargcChar*argv[]) {Glutinit (&argc, argv); Glutinitdisplaymode (Glut_rgb|glut_single); Glutinitwindowposition (0,0); Glutinitwindowsize ( -, -); Glutcreatewindow ("OpenGL 3D View"); Init (); Glutdisplayfunc (display); Glutmainloop (); return 0;}voidinit () {Glclearcolor (0.0,0.0,0.0,0.0); Glmatrixmode (gl_projection); Glortho (-5,5, -5,5,5, the); Glmatrixmode (Gl_modelview); Glulookat (0,0,Ten,0,0,0,0,1,0);}voiddisplay () {glclear (gl_color_buffer_bit); glcolor3f (1.0,0,0); Glutwireteapot (3); Glflush ();}
Effect:
Note: project development
When developing, create new glut project, write code in Main.cpp
When you are new, you have an example from OpenGL
64-bit Ubuntu with Code::Blocks IDE configuration OpenGL development Environment