opengl es - Is drawElements better than or just equal to drawArrays, when drawing quads with textures on each side? -
opengl es - Is drawElements better than or just equal to drawArrays, when drawing quads with textures on each side? -
i want draw many quads, texture on each side. if utilize drawelements , utilize 8 vertices texture coordinates messed , understand why. prepare have specify 24 vertices. drawelements no longer has benefits on drawarrays, or it?
drawarrays: 36 vertices * 3 values = 108 values
drawelements: 24 vertices * 3 values + 36 indices = 108 values aswell
obviously, if didn't care texture coordinates or normals, be:
drawelements: 8 vertices * 3 values + 36 indices = 60 values
but don't performance boost quad. if faces of object weren't rectangles flat stars, share more vertices drawelements worth again.
am missing or can stick drawarrays?
this question similar to: webgl, texture coordinates , obj
by quads, hope mean triangle strips? particularly since tagged webgl.
this whole thing of counting number of values has me scratching head though. not comparing things here. element array may consist of 8-bit (do not this, because not hardware friendly), 16-bit or 32-bit unsigned integers whereas vertex position 2-4 floating-point (32-bit) scalars. 2-bytes per-index less 12-bytes per-vertex position; if factor in number of "values" 2 < 12/3.
gldrawelements (...)
not give performance boost. reason if can re-use vertices avoid running vertex shader on same vertex multiple times (if same vertex appears multiple times in list of input vertices cached transformed value may used instead). however, there primitive types implicitly share vertices such triangle strips, , not need array of indices take advantage of behavior them.
opengl-es textures webgl normals vertices
Comments
Post a Comment