Introduction To OpenGL and to this tutorial series

paradox/vivid

What?

What is OpenGL?

OpenGL (gl to the elites ;) is a like 3D Engine, except it is special, because the routines it contains are on 3D graphics cards. It has all sorts of features and is able to draw all sorts of polygons, that is triangles, quads and polygons, with texture filtering (mipmapping etc) lighting and blending. It contains all functions necessary to handle cameras and rotations of 3d scenes. It also supports a hell of a lot of other stuff like NURBS.

Before you start coding under OpenGL make sure you have at least coded a basic engine yourself, otherwise you'll be lost. By basic I mean with some fillers, ideally, flat shading, gouraud shading, texture mapping and phong shading, and also with camera routines, z buffering and 3d clipping. If you've only coded a subset of the above 3d engine you're still equipped to learn OpenGL, however if you've coded none of them, then you won't be able to learn from these tutorials.

OpenGL is a (free :)) product of SGI, and is based on their IRIS language, and as a result it is really like a language in itself, it ports from platform to platform and from language to language very easily, so although the source is in C++, you could easily use it in Visual Basic, Visual Fortran, Java, etc.

OpenGL supports 3d hardware, I recommend having a 3d card for running the demos, however, don't let it stop you from coding OpenGL, I only got my (32MB :)) 3d card a few weeks ago.

Setbacks

The setbacks of OpenGL are mainly just differences of opinion, if for example, I like to work in Radians, but OpenGL works in Degrees, then I might get annoyed that I don't really have the freedom to work with my own system, but am forced to work with their's.

Although there is more I could say, I'll try not to discourage you.

Overview Of The Tutorials

I've written these tutorials in semi-formal style, kinda informal and kinda formal, sometimes I find when articles are too full of jokes it can become annoying, so that's why I've chosen semi-formal.

There are seven tutorials on OpenGL contained here:

The first one is all about setting up OpenGL, it is also the longest.

The second teaches you how to do a rotating shaded 3d object.

The third teaches you how to do lighting and texture mapping.

The fourth teaches you how to use display lists and the matrix stack.

The fifth teaches you blending.

The sixth is a tutorial on GLUT, the OpenGL clone library for almost all platforms, including DOS, Linux and Windows.

I had planned a tutorial on using the 3D camera in OpenGL but I didn't have time to perfect it and thought it would be better along with a few other topics.

In Hugi #20, I plan tutorials on:

(i) Using the Camera in OpenGL.
(ii) Taking advantage of the matrix hiearchy.
(iii) Advanced lighting: Spotlights and light source attenuation.
(iv) Advanced texture mapping: Wrapping, Env. mapping.
(v) OpenGL's quadric functions gluSphere, gluCylinder etc.
(vi) Mirrors

I will only publish tutorials on these topics if there is a demand, i.e. feedback, otherwise I'll assume my articles are being swallowed by black holes. The first two of those are really essential for coding good OpenGL effects and the current tutorial set leaves you a bit stuck, unless you're intelligent enough to think of some stuff yourself, (ii) is really one which is covered here, in very little detail.

Final Notes

Since we have OpenGL lots more time can be spent perfecting design of demos, this is why when demos using OpenGL have no design it makes them nothing, they have a 3d engine coded for them AND no design! Imo, there haven't been any really good demos under OpenGL yet, I mean really good.

And of course, don't let OpenGL stop you coding your own 3D engine, to really learn how 3D graphics is working you have to know how to code 3D engines, and you should keep updating your own engine while learning OpenGL. I for instance I am continuing to write my own software engine, just to get concepts right, there is not quite as much need to optimise the engine, but I still do, and I'd advise you to do the same.

Finally, if you don't experiment with OpenGL yourself these tutorials will be utterly useless to you, try anything that comes to mind.

Conclusion

That's all you need to get started, except that I need to stress that coding under OpenGL is great, it's very, very easy to learn, and there isn't an ocean of code to drown under. If you do learn from these tuts please give me a little greet in your demo/prod and above all, email me.

(And before I forget, OpenGL coders traditionally hate Direct3D and all Direct3D coders. ;))

-- paradox / vivid