OpenGL Geometry

The core OpenGL library includes functionality to draw arbitrary sets of points, lines, and polygons. These functions are necessary for creating more interesting shapes.

The basic method for drawing any of these shapes is:

glBegin

glVertex
glVertex
glVertex
...

glEnd

Other calls may be made along with the glVertex calls, such as setting the color or providing lighting or texturing data. Each of these pieces of data will be associated with the next vertex that is drawn.
Note, however, that many GL function calls (such as transformations) cannot occur between glBegin & glEnd. The allowable functions are listed on pp. 47-48 of the textbook.

Example code: glGeometry.c

GL_POINTS
GL_LINES
GL_LINE_STRIP
GL_LINE_LOOP
GL_TRIANGLES
GL_TRIANGLE_STRIP
GL_TRIANGLE_FAN
GL_QUADS
GL_QUAD_STRIP
GL_POLYGON

next