[Public WebGL] Oversight in bufferData and bufferSubData specification

Gregg Tavares (wrk) [email protected]
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]>
> wrote:
> > gl.bufferData(gl.ARRAY_BUFFER, asDoubles, ..);  // uploads all 96 bytes
> of
> > 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
> array.
> 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.



>
> Regards,
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20110523/93363b61/attachment.html>


More information about the public_webgl mailing list