[Public WebGL] Oversight in bufferData and bufferSubData specification
Gregg Tavares (wrk)
Mon May 23 13:02:42 PDT 2011
On Mon, May 23, 2011 at 12:53 PM, Cedric Vivier <[email protected]> wrote:
> On Tue, May 24, 2011 at 02:20, Gregg Tavares (wrk) <[email protected]>
> > gl.bufferData(gl.ARRAY_BUFFER, asDoubles, ..); // uploads all 96 bytes
> > mixed data
> > Disallowing the last line doesn't give us one iota of type safety so why
> > specifically disallow it?
> Imho Kenneth's idea is not about type safety, _we can always cast_,
> this is about having better reporting for simple errors/types by
> better expressing the intent of the data you send to GL.
> Consider a much simpler example :
> readModelInto(float64ArrayThatHasBeenCreatedElsewhere); //this fills
> the values of any passed TypedArray from another source eg. a JSON
> gl.bufferData(gl.ARRAY_BUFFER, float64ArrayThatHasBeenCreatedElsewhere);
> This will result in unintended/unexpected results that the developer
> might have hard time to track down as there is absolutely no
> warning/error given to something that is semantically wrong.
No it won't. There is no gl.DOUBLE to pass to gl.vertexAttribPointer.
Matching the type uploaded to the type used in gl.vertexAttribPointer is
always something the developer has to deal with. Most samples that used
mixed types upload all their data through a UInt8Array or Float32Array even
though their data is not uniformly gl.UNSIGNED_BYTE or gl.FLOAT
Disallowing Float64Array will not help the developer in any way
and unnecessarily clutters and complicates the spec.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the public_webgl