0

I noticed that the "mouse events" (and "textures") demo here runs in Chrome, Firefox and Opera (the interface is a little bit bad, so bear with it).

As you can see, the Model, View and Projection matrices are being supplied as vanilla JavaScript arrays. Float32Array only appears once in the 2 scripts, and that is for uploading cube vertex data.

There's something I don't understand about this, because I've thus far assumed all data must go up as typed arrays. I see these options:

  • All arrays DO have to go to calls as typed arrays, yet conversions are implicit.
  • Only certain calls required typed arrays as input. If so, which do/don't? Where can I review this, as WebGL doesn't seem to have official API docs yet!
  • There are discrepancies between how different browser implementations handle this: Some may do implicit array conversion, while others may not.

1 Answer 1

1

The WebGL specification has been available for some time. You can get it from the WebGL Khronos Site. As you can see from the spec, several functions are overloaded, in particular those accepting uniforms (which is how you're specifying the various matrices you mention), to accept both JavaScript arrays and typed arrays. Other functions—mostly those taking larger amounts of data (e.g., textures, vertex arrays, etc.)—are limited to using only typed arrays for performance reasons.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.