The environment used in this practice is CentOS 7.
Reference: http://www.xuebuyuan.com/1472808.html
OpenGL Development Environment Setup:
1.OPENGL Library Installation
OpenGL Library using the Mesa library, install the command:
Yum Intall mesa*
Mesa Library is an open-source three-dimensional computer graphics library that implements the OpenGL application interface in the form of open source. Specific description: https://www.mesa3d.org/intro.html.
2.glut Installation
Download Freeglut, for: https://github.com/dcnieho/FreeGLUT/releases. Glut is OpenGL's utility library, OpenGL is just a three-dimensional graphics interface, and no window, processing mouse and other devices input and output aspects of content, glut provide relevant aspects of the content. Freeglut is a release version of Glut (and one is the original version of GLUT).
Because I use CMake installation, according to the Readme.cmake steps and precautions to install.
Command:
CMake.
Make
Make install
3. Simple examples
New File Main.cpp
#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 ();}
Compile command:
GCC-LGLUT-LGLU-LGL main.cpp
Linux OpenGL Practice Article-1