| Demo Page | Divergence | Installer | Running the demos | Acknowledgements |
|
The first demo sets up the basics needed for an OpenGL application: The window, viewing area, etc. From there we move onto a simple viewer. This viewer shows a level with simple shading which you can move around with using the arrow keys and page up/down. As we move down the demos we introduce some more of the features that make Quake III look good (curved surfaces, textures and so on).
Objects (25k) Source Files (22k) |
|
The second demo introduces some of the 2D features of OpenGL. It also adds a menu. Which is nice. Have a look at ImageLoader, TargaLoader and JPEGLoader at how to read an image in and at Menu to see how its used.
Objects (33k) Source Files (27k) |
|
Here we introduce textures to the level and things are beginning to shape up. Quake III uses 'shaders' to describe how a surface should look. These can be quite complicated in structure so for simplicity we take the first image that a shader references and use that. Checkout Face to see the texture mapping (applying an image to a surface).
Objects (37k) Source Files (30k) |
|
You may have noticed if you ran the last demo that the images don't look right. They are grainy and waver as you move the camera around. This is caused by a problem called aliasing, where the resolution of the image doesn't tie up with the distance the viewer is from the surface being textured. To solve this we introduce a technique called mipmapping. Mipmapping means creating several copies of the image, all of different sizes that we use depending on how far the viewer is from the surface we are viewering. Luckily OpenGL provides utitilies to do this for us. Look at ShaderFactory to see how this is done.
Objects (37k) Source Files (30k) |
|
Things have been slowing down with each addition. Not so good this. So its time to try and address the issue, and with OpenGL we find a thing called vertex arrays comes in useful. Instead of making many calls to OpenGL when we are drawing polygons; we make one call with all the vertexes passed in one go. This is all done in the Surface class.
Objects (37k) Source Files (31k) |
|
One of the big additions in Quake III was curved surfaces. We add them here.
Objects (38k) Source Files (31k) |
|
The final speed related demo. We use OpenGL matrixes and frustum culling to remove any areas from the scene which are not visible within the OpenGL viewport.
Objects (51k) Source Files (46k) |