More Primitives: Points, Lines, Strips, and Fans

When we told you that OpenGL ES was a big, nasty triangle-rendering machine, we were not being 100 percent honest; in fact, OpenGL ES can also render points and lines. Best of all, these are also defined via vertices, and thus, all of the above also applies to them (texturing, per-vertex colors, and so forth). All we need to do to render these primitives is use something other than GL10.GL_TRIANGLES when we call glDrawArrays()/glDrawElements(). We can also perform indexed rendering with these primitives, although that's a bit redundant (in the case of points at least). Figure 7–18 shows a list of all the primitive types OpenGL ES offers.

Figure 7–18. All the primitives OpenGL ES can render ...

Get Beginning Android 4 Games Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.