OpenGL(2) glut库测试

本文详细介绍了如何下载、配置并使用GLUT库,包括添加头文件、链接库及动态链接库到系统路径,以及通过编写简单的OpenGL程序进行测试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

配置方法:

1、将glut.h添加到 C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl 中

2、将 glut.lib 和 glut32.lib 添加到 C:\Program Files\Microsoft Visual Studio 9.0\VC\lib 中

3、将 glut.dll 和 glut32.dll 添加到 C:\Windows\System32 中

测试:

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

#include "stdafx.h"
#include "gl/glut.h"
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glVertex2f(-0.5,-0.5);
glVertex2f(-0.5,0.5);
glVertex2f(0.5,0.5);
glVertex2f(0.5,-0.5);
glEnd();
glFlush();
}
int _tmain(int argc, char** argv)
{
glutInit(&argc,argv);
glutCreateWindow("Hello,world!");
glutDisplayFunc(display);
glutMainLoop();

	return 0;
}
配置:



结果:




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值