[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Should bufferData record array type?



I would recommend against this unless a method for using mixed type buffers is also provided. I currently have a couple of demos where I have interleaved arrays of that include both floating point values and unsigned bytes (for colors). I create the buffer with a Uint8Array and later bind it with the appropriate types, which has turned out to be terribly convenient. Uint8Arrays have also proven useful for passing arbitrary chunks of bytes from XHR requests usingÂresponseType = "arraybuffer" to the GPU without having to worry about byte alignment issues.

In short, the ability to use byte arrays as an opaque data container have proven useful to me, and I'd be willing to guess what I'm not the only one.

--Brandon Jones

On Tue, Jan 24, 2012 at 1:25 PM, Benoit Jacob <bjacob@mozilla.com> wrote:

Hi,

Currently, as far as I can see, we're not checking the type of the array passed to bufferData. So you could pass an array of uint8's to bufferData and later use that buffer in a vertex attrib of a different type, say floats.

I would suggest that (not for 1.0.1 but for a future 1.0.2) we specify that buffers are typed, that the type is set when calling bufferData, and that bufferSubData and vertexAttribPointer must generate an error in case of type mismatch. Or, do you see any reason why this would break reasonable content?

Cheers,
Benoit

-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------