Opengl es 2.0 drawelements line

broken image
broken image

Using vertex arrays reduces the number of function calls and redundant usage of shared vertices. GlBegin(GL_TRIANGLES) // draw a cube with 12 triangles // front face = In immediate mode, you have to provide this shared vertex 6 times, twice for each side as shown in the code. The other thing that you should notice is the vertex 'v0' is shared with 3 adjacent faces front, right and top face.

broken image

If you also specify normals, texture coordinates and colors to the corresponding vertices, it increases the number of OpenGL function calls. A cube has 6 faces, so the total number of glVertex*() calls is 36. Take a look the following code to draw a cube with immediate mode.Įach face needs 6 times of glVertex*() calls to make 2 triangles, for example, the front face has v0-v1-v2 and v2-v3-v0 triangles.

broken image