Texture Size in Shaders

In WebGL 2, you can look up the size of any texture within ESSL shaders using textureSize. With WebGL 1, you'd need to create a uniform and pass the data into the shader manually.

For example:

vec2 size = textureSize(sampler, lod);
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.186.6