下面的一些文档转载自http://www.lighthouse3d.com/opengl/tutorials.shtml 感觉不错,贴出来,做个储备吧
GLUT stands for OpenGL Utility Toolkit. Mark J. Kilgard, to enable the construction of OpenGL applications that are truly window system independent, conceived the GLUT library. Thanks to GLUT, we can write applications without having to learn about X windows or Microsoft's own window system. Kilgard implemented the version for X windows, and later Nate Robins ported it to Microsoft Windows. Thanks to both, you did a great job.
In this tutorial I'll introduce you to the basics of building an application using GLUT. This tutorial won't introduce fancy visual effects in order to keep the code as simple as possible.
What you need
In order to write applications with GLUT you should have the latest version (at the time of writing this, I believe it is 3.7). The GLUT distribution comes with lots and lots of examples so after you read through the basics in here you'll have plenty of material to go on. Check out the GLUTs page.
In order to write a C application using GLUT you'll need three files:
Setting up in Visual C/C++ 6.0
There are two options available for a project in Visual C/C++: console, and Win32. the first is the most common option. The application will have two windows: a console window and the OpenGL window. With Win32 it is still possible to build an application using GLUT without messing up with windows programming. All you have to do is to change one setting.
For an existing console project there is a simple way to transform it into a Win32 application, i.e. to get rid of the console window.
Alternatively just add the following line to the beginning of your c code:
// #pragma comment( linker, "/subsystem:/"windows/" /entry:/"mainCRTStartup/"" )
Note that the line is commented on purpose.
And thats all there is to it, now the application has no console window, just the OpenGL window. In Visual C/C++ you'll have to do the following in order to link an application using GLUT:
Note: I've added glu32.lib and opengl32.lib as well. These are the two libraries for the standard OpenGL. GLU is an API that comes with the standard OpenGL distribution.
OK, so all is set, lets learn how to write GLUT applications. If there is anything that is not quite clear please let me know and I'll try to improve it. Your feedback is important.
I hope you enjoy this tutorial.
Antonio