Mat
Mat

Reputation: 4501

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?

Upvotes: 0

Views: 1068

Answers (2)

nebo3d
nebo3d

Reputation: 51

You can use imageSize() in GLSL 4.3. Take a look at GLSL specification from OpenGL.org.

Upvotes: 2

Nicol Bolas
Nicol Bolas

Reputation: 473437

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.

Upvotes: 1

Related Questions