WebGLSamples / WebGL2Samples

Short and easy to understand samples demonstrating WebGL 2 features
Other
1.01k stars 143 forks source link

texture pixel store #47

Closed shrekshao closed 8 years ago

shrekshao commented 8 years ago

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.

pjcozzi commented 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.

shrekshao commented 8 years ago

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

pjcozzi commented 8 years ago

Ah, yes. OK, this sample is good to go then.