zoukankan      html  css  js  c++  java
  • Window下 VC2008 Express 配置 OpenGL

    参考文章:NehE 的教程 

    http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01

    一,配置opengl环境

    首先,从opengl的官方网站下载GLUT库

    GLUT就是一个在window下OpenGL编程的API,所以我们需要把他的库放到VC库里去,详细的可以的自己在官方网站上看

    链接如下:http://www.opengl.org/resources/libraries/glut/glut_downloads.php#windows

    啥源代码啊资源啊咱不管,直奔目的库,找到如下字样:

    If you want just the GLUT header file, the .LIB , and .DLL files all pre-compiled for Intel platforms, you can simply download the glutdlls37beta.zip file (149 kilobytes).

    这个网址也能下载glut库:http://www.xmission.com/~nate/glut.html

    点击那个有下划线的链接,把这个下载下来, 解压缩,目前有如下文件:

        glut.dll
        glut.h
        glut.lib
        glut32.dll
        glut32.lib

    然后放到相应的地方:我是VC2008,不同版本可能路径不一样

    glut.dll

    glut32.dll 放到  C:/WINDOWS/system32目录下

    glut.h     放到  C:/Program Files/Microsoft SDKs/Windows/v6.0A/Include/gl目录下

    glut.lib

    glut32.lib 放到  C:/Program Files/Microsoft SDKs/Windows/v6.0A/Lib目录下

    二,搭建第一个工程环境

    有2个办法

    1,直接下载 NeHe网页上提供的代码

    网页最下面

    DOWNLOAD Visual C++ Code For This Lesson.

    解压缩以后打开Lesson1.dsw,转换成新版本的VC工程,然后编译运行,

    由于glaux现在不用了,需要修改2个地方:

    a,代码里注释掉这行 //#include <gl/glaux.h>        // Header File For The Glaux Library

    b,工程属性->linker->Input 里面删掉 glaux.lib

    然后编译运行就OK了

    2,按照NeHe网页上说的新建一个Win32 Application 工程,把网页上代码复制过来

    然后在工程属性->linker->Input 加上 opengl32.lib glut32.lib

    编译运行就行

    注:新建的工程会报如下错误:error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [23]' to 'LPCWSTR'

    有2个办法解决这个问题

    a,把所有字符串都加上TEXT()变成宽字符,

    b,工程属性->General->Character Set 里,把Use Unicode Character Set 改成 Use Multi-Byte Character Set就行了

    然后编译运行OK

    3, 运行以后出现对话框,提示是否全屏,选完就进去了,

  • 相关阅读:
    chapter01 Bob'store
    echo拼接
    《PHP和MySql Web》书,<input>属性
    http协议
    asc18_hpl,hpc,hpcg
    考研北邮总结[转发共享]
    考研经验总结【转发共享】
    ISBN号码 201312-2
    出现次数最多的数 201312-1
    相反数 201403-1
  • 原文地址:https://www.cnblogs.com/secbook/p/2655418.html
Copyright © 2011-2022 走看看