0

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?

jozxyqk
  • 16,424
  • 12
  • 91
  • 180
Mat
  • 4,281
  • 9
  • 44
  • 66

2 Answers2

2

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

jozxyqk
  • 16,424
  • 12
  • 91
  • 180
nebo3d
  • 51
  • 2
1

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.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982