[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] ArrayBuffer, Concatenation and String-Array Conversion, a proposal
On Oct 5, 2010, at 2:20 PM, Vladimir Vukicevic wrote:
> ----- Original Message -----
>>> The question here is why isn't there a function for doing these
>>> answer is that it's not common enough; storing a unicode value in an
>>> array isn't done very much.
>> I think it will be.
>> My use case here would be to send, as single JSON file, a complete 3d
>> model could include shader code, and binary data. JSON can be parsed
>> using the built-in accelerated function for doing so, but then you
>> need a way of transforming likely large blocks of text to array
> Sending this stuff as text is generally not a good idea, no matter how it's done; it'll be inefficient for the browser/js engine to work with, at the very least. In this case a two-file solution, one JSON and one raw binary, would probably be the most efficient. I understand the desire to work with a single file, though. One thing we could do is add something to the DataView class for reading/writing strings to/from an ArrayBuffer using a given format; that might be a fairly natural fit for that type of functionality (which has been requested in other contexts as well -- e.g. reading a binary file that has an embedded string that refers to a texture file or something).
And if we were to do that, I would propose we use base64 as the serialization format. The overhead is small, there are many tools for it, and it's already supported in other parts of HTML in the data: URL format. I think it would be a mistake to support some sort of direct binary string format.
You are currently subscribed to email@example.com.
To unsubscribe, send an email to firstname.lastname@example.org with
the following command in the body of your email: