zoukankan      html  css  js  c++  java
  • OpenGL在ubuntu下的成功配置


    sudo apt-get update 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

    /*******1-执行以上命令配置环境************/

    cd vim test.cpp

    /建立一个c++文件 

    #include <GL/glut.h>
    
    
    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 3D View");
        init();
        glutDisplayFunc(display);
        glutMainLoop();
    
        return 0;
    }
    //网上的测试代码
    :wq

    /*****************以上是完成了一个c++文件的书写**********/

    【我所遭遇的问题】

    //(大写)L和(小写)l      与     (大写)I   的错误输入 。

     

     最后

     

     /*************恭喜你(我),我们配置好了**********/

    如果走在雨中,带着抱怨的心情,也要前进。
  • 相关阅读:
    java+selenium自动化-IE浏览器搭建自动化环境
    python中的opencv
    随机森林参数说明
    剑指offer
    Python中常用的包--sklearn
    Anaconda安装,jupyter notebook 使用说明
    C++中的Public 、Private、Protected 区别
    C++类中的Static关键字二
    C++类中的Static关键字
    c语言二级指针内存模型
  • 原文地址:https://www.cnblogs.com/litingyuan/p/11603160.html
Copyright © 2011-2022 走看看