I am using an offscreen rendering to a 2D texture. My first shader will output YUV values and second fragment shader reads YUV from the offscreen texture. In the second shader, I manipulate U and V and make it between -0.5 to 0.5 range. But these get clamped to 0 to 1 (positive) as soon as I try to render it. All my negative values become 0.
Found the issue to be here :
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA,
width, height, 0, GLES20.GL_RGBA,
GLES20.GL_UNSIGNED_BYTE, null)
If I use GL_FLOAT instead of GL_UNSIGNED_BYTE, it will give me error as color format is not matching. From the link, https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml looks like all supported formats will clamp to 0-1 range. How to get negative values also in next texture.
Found that I can use other image formats like GL_R16F but none of them are supported in the link / in GLES20.