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

Re: [Public WebGL] ArrayBuffer, Concatenation and String-Array Conversion, a proposal




----- Original Message -----
> > The question here is why isn't there a function for doing these
> > conversions between JavaScript Strings and Arrays? I suppose the
> > 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 in a format parsable by javascript. In the ideal case, that 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
> buffers.

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).

    - Vlad
-----------------------------------------------------------
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: