0

is there a faster method to read pixel data than getimagedata() ? I'm using THREE.js and so far in order to get the pixel's colors from an image and use them into my scene I have to read the pixel data directly from a canvas element, is there a faster way?

cheers

Memo Lestas
  • 393
  • 1
  • 4
  • 13

1 Answers1

0

getimagedata() is a html5 canvas method. If you want to manipulate the pixel values, then you need to look further into WebGL fragment-shaders. If you need the pixel data for something else, then I don't think there's a faster method.

John
  • 264
  • 2
  • 5
  • aparently ther is no way to get the data from the shader outside of it, I need the texels colors to be use from something else in the scene – Memo Lestas May 10 '13 at 12:43
  • Can you further describe what you would like to do? – John May 10 '13 at 14:44
  • I want to read each pixel's color from an image and assign each of them to a different particle, below is one approach am attempting http://stackoverflow.com/questions/16436967/how-to-do-particles-texture-mapping-with-three-js-shadermaterial – Memo Lestas May 10 '13 at 15:35
  • Is [this](http://creativejs.com/tutorials/three-js-part-1-make-a-star-field/) an example for what you are doing? If so, you need to use getImageData(). – John May 10 '13 at 16:35