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

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

glut.h ---> C:\ProgramFiles (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

 

打开vs2010,随便打开或新建一个项目。选择 project->project property-> ConfigurationProperties->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;

 

}

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值