• Setting up an OpenGL development environment in ubuntu


    1.opening terminal window and entering the apt-get command for the packages:

    • sudo apt-get install mesa-common-dev
    • sudo apt-get install freeglut3-dev

    2.Testing 

    #include "GL/freeglut.h"
    #include "GL/gl.h"
    
    /* display function - code from:
         http://fly.cc.fer.hr/~unreal/theredbook/chapter01.html
    This is the actual usage of the OpenGL library. 
    The following code is the same for any platform */
    void renderFunction()
    {
        glClearColor(0.0, 0.0, 0.0, 0.0);
        glClear(GL_COLOR_BUFFER_BIT);
        glColor3f(1.0, 1.0, 1.0);
        glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
        glBegin(GL_POLYGON);
            glVertex2f(-0.5, -0.5);
            glVertex2f(-0.5, 0.5);
            glVertex2f(0.5, 0.5);
            glVertex2f(0.5, -0.5);
        glEnd();
        glFlush();
    }
    
    /* Main method - main entry point of application
    the freeglut library does the window creation work for us, 
    regardless of the platform. */
    int main(int argc, char** argv)
    {
        glutInit(&argc, argv);
        glutInitDisplayMode(GLUT_SINGLE);
        glutInitWindowSize(500,500);
        glutInitWindowPosition(100,100);
        glutCreateWindow("OpenGL - First window demo");
        glutDisplayFunc(renderFunction);
        glutMainLoop();    
        return 0;
    }
  • 相关阅读:
    js小数点失精算法修正
    ActiveX控件之ActiveXObject is not defined
    js通过日期计算属于星期几
    标准日期格式化
    js阿拉伯数字转中文大写
    RPC 原理的前生今世
    大型网站架构系列:20本技术书籍推荐
    Zookeeper核心机制
    建造者模式
    模板方法模式
  • 原文地址:https://www.cnblogs.com/onlycxue/p/3227070.html
Copyright © 2020-2023  润新知