I’m trying to read a texture that’s been loaded with floating-point values using my generic code for reading images, which tries to read it out as (8-bit) integer values.
I was expecting it to clamp the values to 0..1 and to basically make it look pretty horrible, but still recognizable. Instead, it’s completely black, as if it read all black values.
The texture is GL_R32F format and I’m trying to read it as GL_UNSIGNED_BYTE with GL_RGBA as output.
Should this work? If not, what kind of thing should I be looking for?
glGetTexImageshould be able to return what you want (8 bits unsigned). Obviously, the image read back would not be as smooth as the original because of precision loss (32 bits to 8 per component).However, I must say I don’t think I’ve ever done this specifically with an R32F internal format… Try with different formats to see if you get different results. Also, make sure all the conditions for
glGetTexImageto work are met (texture bound, no buffer bound toGL_PIXEL_PACK_BUFFER, etc.). See the doc forglGetTexImagefor all conditions.