Game Development Reference
In-Depth Information
Figure 5.7
GL_TRIANGLES and GL_TRIANGLE_STRIP .
Coloring and Spinning the Triangle
The Hello World program of the 3D programming world is a spinning triangle
with each vertex colored for red, green, and blue. This demonstrates all the basic
graphics functionality is working, and an experienced graphics programmer can
easily build from this.
Vertices can store lots of different information. At the moment, the three vertices
here only have position data. Color data can be added in immediate mode by
setting the color information before each vertex call.
Gl.glBegin(Gl.GL_TRIANGLE_STRIP);
{
Gl.glColor3d(1.0, 0.0, 0.0);
Gl.glVertex3d(-0.5, 0, 0);
Gl.glColor3d(0.0, 1.0, 0.0);
Gl.glVertex3d(0.5, 0, 0);
 
Search WWH ::




Custom Search