PDA

View Full Version : Can I pass a JavaScript byte array to glTexImage2D?



zexx
09-09-2011, 02:57 AM
I intend to continuously generate images in memory, then send them to glTexImage2D.

Is it possible to send JavaScript arrays directly? Because all the WebGL examples I saw are using HTML Image objects. That's not what I need.

Also, some people suggested the use of the Canvas object, but seems that Canvas is slow. Since I already have all the pixels in an array, do I really need a Canvas as mediator?

johnny_scott
09-11-2011, 08:18 PM
I intend to continuously generate images in memory, then send them to glTexImage2D.

Is it possible to send JavaScript arrays directly? Because all the WebGL examples I saw are using HTML Image objects. That's not what I need.

Also, some people suggested the use of the Canvas object, but seems that Canvas is slow. Since I already have all the pixels in an array, do I really need a Canvas as mediator?

I cannot give you an exact how to however I know it is possible to create image objects from byte arrays.