'Can I use an integer texture as if it was normalized?
I have a texture that has the format GL_RED_INTEGER
. This texture has been generated with a compute shader.
I have another shader that I use for debugging that just displays the texture. Since it's an integer texture, I have to declare it in the shader as usampler2D
. And also I have to divide it by 255.0
, in order to normalize it.
However, I would like to reuse this debugging shader for other non-integer textures.
I though there might be some way to use the integer texture as if it was normalized. Is there?
Solution 1:[1]
I just remembered texture views exist in OpenGL. It's important to make sure that the texture has been allocated with glTexStorage2D
as opposed to glTexImage2D
; otherwise it's not possible.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | tuket |