1,直接安装 freeglut,mesa 即可。这个可以满足基本的opengl学习需求。
2,如果要更多功能,可以安装gl开头的几个文件。
3,arch下用pacman直接安装。
#include <GL/glut.h>
void init();
void display();
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowPosition(0, 0);
glutInitWindowSize(300, 300);
glutCreateWindow("OpenGL 3D View");
init(); glutDisplayFunc(display);
glutMainLoop();
return 0;
}
void init()
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glOrtho(-5, 5, -5, 5, 5, 15);
glMatrixMode(GL_MODELVIEW);
gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 0, 0);
glutWireTeapot(3);
glFlush();
}
// -lGL -lGLU -lglut
本文介绍了在Linux系统中如何安装OpenGL,包括基本的freeglut和mesa安装,以及如何获取更多功能的GL库,特别提到在Arch系统下使用pacman命令进行安装。
2920

被折叠的 条评论
为什么被折叠?



