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

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




On Jan 24, 2012, at 1:40 PM, Benoit Jacob wrote:




I don't think this can (or should) work.

First, passing ArrayBuffer (untyped) is completely valid and useful. There's no way to track type on this.

Second, using combined types in the same buffer is a very common practice - in this case, one often passes just the ArrayBuffer, but there's nothing preventing them from passing one of the data arrays instead.
Right, so let's forget about this. Thanks for the reality check. I only thought about the specific case of passing a  typed array of a certain type and using it as a single attrib of a different type, and didn't think about the rest.

Still, it's a pity that we can't do anything to ban that (passing a  typed array of a certain type and using it as a single attrib of a different type).

But you might not use a typed array at all. You might use XHR to read data into an ArrayBuffer and pass that directly to the context. It would be a shame to require the author to do some artificial type stamping of a buffer just so we can do some checks. The better approach is to make sure nothing bad happens no matter what values you pass to what VBO.

-----
~Chris