glQuery/glQuery — Issue #8: Determine whether
Author: rehno-lindeque
Created: 2011-12-27 17:51:58+00:00
State: open
Labels: Defect

Currently glQuery uses

context.getBufferParameter(context.ARRAY_BUFFER, context.BUFFER_SIZE);

and

context.getBufferParameter(context.ELEMENT_ARRAY_BUFFER, context.BUFFER_SIZE);

to determine the buffer size for calculating the number of vertices per draw call.

While this value is being cached as of 523248e05d6a39a19063ef02b818750e53a67d72 it is still a very expensive call on at least some computers (as can be seen in this benchmark: http://jsperf.com/getbufferparameter-performance).

Furthermore, the size of this buffer object can be changed by a call to `bufferData(...)` (http://www.khronos.org/registry/webgl/specs/latest/#5.14.5)

In the case where a buffer object is used directly we should decide on either...

* Supply the number of primitives to the call to `gl.geometry(...)`
* Supply the buffer size as a parameter to `gl.vertexAttrib(...)` or `gl.vertexElem(...)` keeping in mind that the buffer size can change and may need to be updated with another call to `gl.vertexAttrib(...)` or `gl.vertexElem(...)` later.