zoukankan      html  css  js  c++  java
  • Windows 7 Visual Studio 2008配置OpenGL开发环境

    Windows 7 Visual Studio 2008配置OpenGL开发环境

     

     

    glut下载地址: http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip

     

    glut.h ---> C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl

    glut.dll,glut32.dll ---> C:\Windows\SysWOW64 (windows7 64位操作系统)

                        ---> C:\Windows\System32 (windows7 32位操作系统)

     glut.lib,glut32.lib ---> C:\Program Files\Microsoft Visual Studio 9.0\VC\lib

     

    打开vs2008,随便打开或新建一个项目。 选择 project->project property-> Configuration Properties->Linker->Input->Additional Dependencies 在其中添加opengl32.lib glu32.lib glut32.lib

    在工程中添加如下代码即可。

     

    // glExampl01.cpp : Defines the entry point for the console application.

    //

     

    #include "stdafx.h"

    #include <Gl\glut.h>

    void myDisplay(void)

     

    {

     

        glClear(GL_COLOR_BUFFER_BIT);

       

        glColor3f (1.0,0.0,0.0);

        glBegin (GL_LINES);

            glVertex2i (180,15);

            glVertex2i (10,145);

        glEnd();

     

        glRectf(-0.5f, -0.5f, 0.5f, 0.5f);

     

        glFlush();

     

    }

     void init (void)

     {

         glClearColor(1.0 ,1.0, 1.0,0.0);

     

         glMatrixMode (GL_PROJECTION);

         gluOrtho2D(0.0,200.0,0.0,150.0);

     

     }

     

    int _tmain(int argc,char * argv[])

    {

       

        glutInit(&argc, argv);

     

        glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);

     

        glutInitWindowPosition(50, 100);

     

        glutInitWindowSize(400,300);

     

        glutCreateWindow("OpenGL");

     

        init ();

     

        glutDisplayFunc(&myDisplay);

     

        glutMainLoop();

     

        return 0;

     

    }

     

     

  • 相关阅读:
    get started with laravel
    redis消息队列
    javascript模板引擎Mustache
    YIi 权限管理和基于角色的访问控制
    Yii CDbCriteria
    C++ 推断进程是否存在
    IE浏览器开启对JavaScript脚本的支持
    最小公约数(欧几里得算法&amp;&amp;stein算法)
    Nyoj 43 24 Point game 【DFS】
    【蓝桥杯】PREV-5 错误票据
  • 原文地址:https://www.cnblogs.com/mothe123/p/3419511.html
Copyright © 2011-2022 走看看