Using the OpenGL moduleUsing the module is really simple, just stick to the following steps:
You're probably thinking that this doesn't sound all the simple, but really it is. As an example I've also included a quick spinning cube OpenGL program to give you a working example. Sample code that uses the other sample code: gldemo2.c Comments on the sample code GLDemo2.c actually demonstrates quite a few different things in addition to dynamic-loading of the opengl driver, starting with full-screen mode (which judging by how often this question is asked in the opengl newsgroup, oughtta make it worth a look-see for most people right there). Hopefully the code itself is fairly self-explanatory, I've tried to comment it fairly well. What it doesnt demonstrate well however, is how to setup a proper camera. Those of you more familiar with OpenGL are doubtless gasping in horror at the fact that I put the camera transform in the projection matrix. And yes I know that this is technically a no-no, as it invalidates OpenGL's fogging and lighting operations. However, in self-defense I'll just point out that this code was originally written a long time ago to run on a MiniDriver which has neither fogging nor lighting (so there). Still readers should beware that this is wrong, evil and just plain bad. Do not imitate my laziness, put the camera in the modelview matrix where it belongs - something I will leave to a future article. Is all this renaming stuff really necessary Actually you could probably get by without it by compiling the opengl.c module with a few changes as a lib file. However, because you would be dealing with GDI functions etc, link order would become important, complexity would begin spiraling upward, life as we know it would end, and I decided it wasn't worth the bother. I'd like to give a special thanks to Dan Mintz for his help in adding support for the full list of OpenGL functions to the module, as well as help with testing on various card/driver combinations. |