Primitives
Syntax
glBegin (parameter)
appropriate functions...
glEnd();
Parameter |
Definition |
GL_POINTS |
Single points |
GL_LINES |
Non-connected lines |
GL_LINE_STRIP |
Series of connected lines |
GL_LINE_LOOP |
Closed loop of connected lines |
GL_TRIANGLES |
Single triangles |
GL_TRIANGLE_STRIP |
Series of connected triangles |
GL_TRIANGLE_FAN |
Set of triangles containing a common central vertex |
GL_QUADS |
Quadralaterals |
GL_QUAD_STRIP |
Series of connected quadralaterals |
GL_POLYGON |
Polygon with an arbitrary number of vertices |
Appropriate Functions Within GlBegin() - glEnd()
glVertex () |
glColor() |
glIndex() |
glNormal() |
glTextCoord() |
glEvalCoord() |
glEvalPoint() |
glMaterial() |
glEdgeFlag() |
glCallList() |
glCallLists() |
glVertex() |
Drawing Lines in 3D
Modifying Line Width
Antialiasing
Stipple Patterns for Lines
before moving on
they are not drawn. Note that they are applied in reverse order.
Drawing Polygons in 3D
Value |
Definition |
GL_POINT |
Each vertex specified is rendered as a single point, which can be controlled by points states discussed earlier. This produces the same effect as calling glBegin() with GL_POINTS |
GL_LINE |
This will draw the edges of the polygon as a set of lines. Any of the lines states discussed previously will affect how the lines are drawn. This is similar to calling glBegin() with GL_LINE_LOOP |
GL_FILL |
The default state, which renders the polygon with the interior field. This is the only state in which polygon stipple and polygon smoothing will take effect |
Polygon Face Culling
Hiding Polygon Edges
Triangles
glVertex3f(-2.0, -1.0, 0.0);
glVertex3f(3.0, 1.0, 0.0);
glVertex3f(0.0, 3.0, 0.0);