1

I have created a texture and filled it with some data:

glBindTexture(GL_TEXTURE_2D, head_pointer_image);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R32UI, width, height, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, data);

Then I bound it to 0:

glBindImageTexture(0, head_pointer_image, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R32UI); 
glUniform1ui(0, 0); // Not sure if necessary 

If I check the data with glGetTexImage() I get correct values, but if I try to read it in my shader, I only get zeros.

layout(binding = 0, r32ui) coherent uniform uimage2D head_pointer_image;

uint value = imageLoad(head_pointer_image, ivec2(gl_FragCoord.xy)).r;

What am I doing wrong?

genpfault
  • 51,148
  • 11
  • 85
  • 139
Rhu Mage
  • 667
  • 1
  • 8
  • 21

1 Answers1

0

I have received outside help, the problem was that my texture was incomplete due to the default minification filtering being GL_NEAREST_MIPMAP_LINEAR which requires a full mipmap chain and I only had the base level image.

Setting GL_TEXTURE_MIN_FILTER to GL_LINEAR fixed my issue.

Rhu Mage
  • 667
  • 1
  • 8
  • 21