It is possibile to create a texture (to use on a element in a canvas) from the getImageData array of another canvas (in the same html page)? maybe without three.js? Thanks a lot,
Jennifer
It is possibile to create a texture (to use on a element in a canvas) from the getImageData array of another canvas (in the same html page)? maybe without three.js? Thanks a lot,
Jennifer
Thats the point of getImageData, getting an image to manipulate it and then draw on any canvas.
doing things like: http://jsfiddle.net/jaibuu/myRGr/
If you don't intend to do pixel manipulation, you should only use drawImage(), without getImageData/putImageData which are slower though.
Yes, texImage2D can take an ImageData.
Here are is one of the WebGL conformance tests that test this functionality
https://www.khronos.org/registry/webgl/sdk/tests/conformance/textures/tex-image-and-sub-image-2d-with-image-data.html
The coolest thing about WebGL's
texImage2D
method is that its last argument can be a DOM element instead of an ArrayBuffer, in which case it copies its rendered content into your texture object.For example:
There's a little tutorial about this feature here.