2000以上系统均带有OPENGL32.DLL和glu32.dll,如果要GLUT.DLL的话就得下载
http://upload.programfan.com/upfile/200607311626279.zip
Windows环境下安装GLUT的步骤:
1、将下载的压缩包解开,将得到5个文件
2、在“我的电脑”中搜索“gl.h”,并找到其所在文件夹(如果是VisualStudio2005,则应该是其安装目录下面的“VC/PlatformSDK/include/gl文件夹”)。把解压得到的glut.h放到这个文件夹。
3、把解压得到的glut.lib和glut32.lib放到静态函数库所在文件夹(如果是VisualStudio2005,则应该是其安装目录下面的“VC/lib”文件夹)。
4、把解压得到的glut.dll和glut32.dll放到操作系统目录下面的system32文件夹内。(典型的位置为:C:/Windows/System32)
Visual C++ 6.0 HOWTO:
1。下载GLUT库:http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip
2。将压缩包内的glut.h放到.../Microsoft Visual Studio/VC98/Include/GL目录下
将glut32.lib放到.../Microsoft Visual Studio/VC98/Lib目录下
将glut32.dll放到X:/windows/systom32目录下(win98用户放到X:/windows/systom目录下)
3。建立一个控制台工程Win32 Console Application,加入hello.c并运行:
#i nclude <GL/glut.h>
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);/* clear all pixels */
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);/* draw white polygon with corners at(0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)*/
glVertex3f (0.25, 0.25, 0.0);
glVertex3f (0.75, 0.25, 0.0);
glVertex3f (0.75, 0.75, 0.0);
glVertex3f (0.25, 0.75, 0.0);
glEnd();
glFlush ();/* start processing buffered OpenGL routines */
}
void init (void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);/* select clearing color */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);/* initialize viewing values */
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);/*Declare initial display mode(single buffer and RGBA).*/
glutInitWindowSize (250, 250); /*Declare initial window size.*/
glutInitWindowPosition (100, 100);/*Declare initial window position.*/
glutCreateWindow ("hello");/*Open window with "hello"in its title bar.*/
init ();/*Call initialization routines.*/
glutDisplayFunc(display); /*Register callback function to display graphics.*/
glutMainLoop();/*Enter main loop and process events.*/
return 0; /* ANSI C requires main to return int. */
}