Advertisement

other primitive shapes?

Started by October 07, 2002 04:05 PM
3 comments, last by pyro1245 22 years, 4 months ago
i know about GL_QUADS and GL_TRIANGLES and GL_LINES, but im curious if there is any other primitive shapes that can be drawn using glBegin(). can anyone give me a list of them and how to use them? thanks.
GL_TRIANGLE_STRIP and GL_TRIANGLE_FAN would be the two most important ones. May I suggest trying the MSDN libray (has docs for up to 1.1) and getting the Red Book (link on NeHe if i remember correctly).
Advertisement
GL_POLYGON: each call to glVertexX is a point on the polygon, until the next call of glEnd. I don''t know how it handles concave polygons, though...

Also, GL_LINE_LOOP is one that''s really rare, and it''s not technically a primitive.

Peace,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links


[twitter]warrenm[/twitter]


Well, there''s also GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_LINE_LOOP, GL_LINE_STRIP, and GL_QUAD_STRIP.

The first three vertices specified for GL_TRIANGLE_STRIP and GL_TRIANGLE_FAN create a triangle just like GL_TRIANGLES. However, after that, each new vertex will create a new triangle. It works a little something like this for GL_TRIANGLE_STRIP:

4--3
| /|
|/ |
1--2

and like this for GL_TRIANGLE_FAN:
7--6--5
\ | /|
\|/ |
1--4
|\ |
| \|
2--3

With GL_TRIANGLE_STRIP, once the initial triangle is specified, the next vertex, and the last two vertices from the previous triangle, create the next triangle.

With GL_TRIANGLE_FAN, the first point is the center of the fan, and additional vertices will create a fan around this center point.

GL_QUAD_STRIP is similar to GL_TRIANGLE_STRIP, but creates quads instead, and needs two new vertices to create the next quad, rather than only one.

GL_LINE_STRIP and GL_LINE_LOOP are pretty much the same thing. GL_LINE_STRIP will create a series of connected lines; each new vertex will create a new line segment. GL_LINE_LOOP does the same thing, but once all the vertices are processed, a line segment will connect the first and last vertex.

Hopefully, these explanations aren''t too confusing, and I don''t think I missed any. Your best bet would probably to just search around a bit on the web. I believe the OpenGL red book is available on-line. I don''t have the link, but it shouldn''t be too difficult to find with an appropriate search.
OpenGL does draw any polygon, but they garuntee only the result from the convex one

This topic is closed to new replies.

Advertisement