Anyway, this tutorial is intended for C (or C++) programmers who have a moderate to strong grasp of the language. There is no 3D experience required to learn OpenGL, although it could help make some of the concepts clearer. One of the nice things about OpenGL is that it's easy to use – the interface is straightforward with no excess baggage. Likewise rather than use COM to provide an object-oriented paradigm in both C and C++, OpenGL is implemented as C functions which can be organized in any manner you see fit. There are good C++ encapsulations of OpenGL availible, but in this tutorial I'm just going over the basics, so I won't hide the interface. Now on that note, lets get started.

I. Introduction To OpenGL

OK, I assume if you're still here then you're hyped up to begin learning OpenGL. First off, you have to get the libraries…

OpenGL should be availible on whatever platform you happen to be on. The libraries and headers for Microsoft's version comes with Visual C++, or you can download them from Microsoft's site. Alternativly, you can hunt around for SGI's drivers at http://www.sgi.com/. If you're running Linux, I'd suggest getting Mesa. It's availible for free at sunsite (ftp://sunsite.unc.edu/pub/packages/development/graphics/mesa/). Whichever OGL library you get, you're also going to need some sort of windowing system to support it. For these examples I'm going to be using the GLUT, or OpenGL Utility Toolkit (ftp://sunsite.unc.edu/pub/packages/development/graphics/glut/). GLUT's main job is to provide a window to draw your OpenGL code into. GLUT is also portable, which means you can compile the same code for both Win95 and X-Windows.

Now that that's out of the way, lets go on to:

/**********************************************************************/

/******************************************/



2 из 19