Closed shrekshao closed 8 years ago
The use of canvas looks fine, but why is it needed? AFAIK pixelStorei
should affect texImage2D
regardless of if the input is an Image
, typed array, etc.
I think the reason here is that there are two versions of texImage2D
, the one we use in this sample with a specific size info due to we skip some pixels of the image needs to have a data array input.
You can see the difference here https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.6
Ah, yes. OK, this sample is good to go then.
I use a canvas to get the pixel data array of the loaded image, not sure if it's okay to do so. It looks a little weird to me but that's the only method I get so far.