Thank you for visiting Blazing Games

Making CQGL

OpenGL thinks of the world as being made up of simple polygons placed in 3D space. The most primitive 3D polygon is the triangle. Triangles have the advantage that by their nature they will always exist on a single plain. More advanced polygons, such as quads, don't have this feature so it is possible to accidentally place one of the nodes off of the plain that forms the polygon which can cause rendering problems. The nice thing is that all of the more advanced polygons can be made up of triangles. For the most compatibility and fewest problems, it is always a good idea to use triangles when describing objects.

As Coffee Quest is made up of tiles that are essentially extruded into 3D, the only real objects that are needed are a cube and a floor/ceiling segment. The easiest way of rendering the world would be to place all the floor and ceiling objects that make up the level into the world and adjusting their location based on the player. The player is a camera set in the center of the world and as the player moves we move the world around the player. The thing is that a cube is a minimum of 8 triangles (no top or bottom needed). This means that with larger levels there would be tens or hundreds of thousands of triangles needed for every frame. As most of these are too far away that they are not likely to be seen, the quickest and easiest way of reducing the polygon overhead is to simply only draw a block of tiles surrounding the player.

The polygons make an interesting 3D world, but it is kind of bland. Texturing in 3D can be done by using a technique known as texture mapping. The texturing features of OpenGL are actually really powerful as each node that makes up the polygon can be mapped to any point on the image that is being used as the texture.

The best feature of OpenGL is the lighting support. Lighting is done by assigning a normalized vector to each node that points toward the light source. My setting the light source to the player, we get rather interesting lighting with almost no effort. More advanced lighting would certainly be possible.

Previous page
Chapter 5 Page 3

About - Privacy Policy - Contact - Links - FAQ
Copyright © 2009 Blazing Games Inc. All Rights Reserved