zoukankan      html  css  js  c++  java
  • 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;
    }
  • 相关阅读:
    蓝桥杯 全球变暖(dfs)
    Bzoj3196 Tyvj 1730 二逼平衡树
    Bzoj3110 [Zjoi2013]K大数查询
    Bzoj4004 [JLOI2015]装备购买
    Bzoj2115 [Wc2011] Xor
    Bzoj1257 [CQOI2007]余数之和sum
    HDU1724 Ellipse
    Bzoj2178 圆的面积并
    SPOJ CIRU The area of the union of circles
    CodeForces 232E.Quick Tortoise
  • 原文地址:https://www.cnblogs.com/onlycxue/p/3227070.html
Copyright © 2011-2022 走看看