linux opengl安装教程,Ubuntu 13.04 安装 OpenGL
在Ubuntu 13.04下安装 OpenGL过程记录。
sudo apt-get install build-essential
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libglu1-mesa-dev
sudo apt-get install freeglut3-dev
测试程序
#include
void init(void){
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);
return;
}
void display(void){
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0,0,0);
glutWireTeapot(3);
glFlush();
return;
}
int main(int argc,char *argv[]){
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowPosition(0,0);
glutInitWindowSize(300,300);
glutCreateWindow("OpenGL #D View");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
编译运行
gcc test.c -o test -lGL -lGLU -lglut
./test.c


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
