OpenGl read and write to the same texture

后端 未结 4 1149
既然无缘
既然无缘 2020-12-11 05:18

I have a RGBA16F texture with depth, normal.x, normal.y on it. I want to read r, g, b and write to a on the texture. I will hit every pixel exactly once.

Would there

4条回答
  •  悲哀的现实
    2020-12-11 06:04

    This can be done if you can write first and then copy the result to a texture. In this case, you render with your shader first and then after it all gets rendered, you would copy the result to a texture with

    glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, windowWidth, windowHeight, 0,GL_RGB, GL_UNSIGNED_BYTE, 0);
    

    And also use this texture as the input of your shader.

提交回复
热议问题