ubuntu下用code::blocks IDE配置opengl开发环境
1、配置开发环境: 相关安装如下图

3、配置code::blocks IDE下的opengl开发环境: Code::block下settings---compiler..---Linkersettings找到并分别添加libGL.solibGLU.solibglut.so



5、测试运行opengl案例: 1、添加opengl经典的水壶代码 代码如下:#include <GL/glut.h>#inc造婷用痃lude <stdlib.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();}
6、 2、编译运行 点击 编译与运行 一个可爱的小茶壶出来了吧
