Open klren0312 opened 1 year ago
uniform vec2 u_ImageSize; void main () { vec2 onePixel = vec2(1.0) / u_ImageSize; }
const u_ImageSize = gl.setUniformLocation(program, 'u_ImageSize') gl.uniform2f(u_ImageSize, image.width, image.height)
uniform sampler2D u_Sampler; void main () { vec2 onePixel = vec2(1.0) / vec2(textureSize(u_Sampler, 0)); }
webgl2使用textureSize获取贴图大小
textureSize
https://registry.khronos.org/OpenGL-Refpages/gl4/html/textureSize.xhtml
webgl1
webgl2
参考资料
webgl2使用
textureSize
获取贴图大小https://registry.khronos.org/OpenGL-Refpages/gl4/html/textureSize.xhtml