Game Development Reference
In-Depth Information
You may draw as many vertices as you want between the begin and end calls. The
current vertex is being drawn at 0,0,0, which will be right in the center of the
screen. The scene is currently set up according to OpenGL's default settings.
Figure 5.5 is a drawing of a cube that describes the default setup of the OpenGL
scene. A point can be rendered anywhere in this cube, but if any of the coordinate
numbers are lower than minus one or greater than one, then the point will
be outside the scene and therefore won't be visible. The camera viewing this
scene can be considered to be at 0, 0, 1 facing -1 on the Z axis.
The position 0,0,0 is often referred to as the origin of the scene. After the vertex is
drawn, the closing brace is written, followed by the end call. Run the program
and you should see a white pixel in the middle of the screen. This is the point
being drawn. It's quite small, but the point drawing size is easy to adjust
in OpenGL. Add Gl.glPointSize(5.0f); just before the glBegin state-
ment. The point should be much easier to see now.
Triangles
OpenGL supports a number of primitive types that can be made from vertices.
The majority of games use triangle strips to represent everything. The 3D
Figure 5.5
Default OpenGL scene.
 
Search WWH ::




Custom Search