Search code examples
openglglslimage-unit

GLSL 4.2 - how to retrieve size of image?


In GLSL 4.2 one can use the image2D datatype with imageLoad and imageStore functions. those functions take ivec to determine which pixel to write/read. in order to calculate the proper ivec, i need to know the size of the image. But how do I retrieve this?

textureSize() seems to work only with samplers, not with images.

How to do it?


Solution

  • You don't. They didn't put in a function to get the image's size, so you'll have to pass it in via a uniform.