VS2010下配置使用OpenGL的glut库

http://www.xker.com/page/e2011/0805/102107.html

在win7(windows7 ultimate SP1)下成功安装VS2010(Visual Studio 2010 ultimate x86)。

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

(参见:http://www.opengl.org/resources/libraries/glut/glut_downloads.php)

原文讲: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).

这个zip文件中有5个文件:

VS2010下配置使用OpenGL的glut库

分别把这5个文件放到如下文件夹中:

glut.h ---> C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\gl

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

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

glut.lib,glut32.lib ---> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib

编写代码时,加入头文件#include <gl\glut.h>即可。

配置完成。

测试代码:

#include <gl\glut.h>


void myDisplay(void)
{
    glClear(GL_COLOR_BUFFER_BIT);
    glRectf(-0.5f, -0.5f, 0.5f, 0.5f);
    glFlush();
}


int main(int argc, char *argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
    glutInitWindowPosition(100, 100);
    glutInitWindowSize(400, 400);
    glutCreateWindow("第一个OpenGL程序");
    glutDisplayFunc(&myDisplay);
    glutMainLoop();
    return 0;
}


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值