VC++2008环境下的OpenGL配置

VC++2008环境下的OpenGL配置

蒋明原(2009-3-7)

1. 下载glut包:http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip 里面包含了glut32.lib glut32.dll以及glut.h

2. 将glut.h放到C:/Program Files/Microsoft SDKs/Windows/v6.0A/Include/gl目录下;glut32.lib放到C:/Program Files/Microsoft SDKs/Windows/v6.0A/Lib目录下;glut32.dll放到C:/WINDOWS/system32目录下

3. 新建project,选择win32 console project,project名为new

4. 在改写new.cpp内容为以下内容:

#include "stdafx.h"

#include

void myDisplay(void)

{

     glClear(GL_COLOR_BUFFER_BIT);

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

     glFlush();

}

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

{

    glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);

    glutInitWindowPosition(100, 100);

    glutInitWindowSize(400, 400);

    glutCreateWindow("第一个OpenGL程序");

    glutDisplayFunc(&myDisplay);

    glutMainLoop();

     return 0;

}

5. 设置IDE环境:project->new Property->Configuration propertites->linker->Input->Additional dependencies

里面加入opengl32.lib glut32.lib这两个lib,应用、确定。

6. F5,start debugging,应该能看到一个窗口,中间区域为白色正方形。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值