Question

Hopefully this is a really simple question.

How to write out to a texture attached to framebuffer from within a fragment shader. I assume it is just gl_FragColor, am I suppose to define/use a different variable, like gl_Data[0]?

Frag Shader:

        precision mediump float;
        varying vec2 vTextureCoord;
        uniform sampler2D displayTexture;
        void main() {
          gl_FragColor = texture2D(displayTexture, vTextureCoord);
        }

This question is not how to setup a texture for writing to, just how to write out from within the fragment shader. I just want to make sure I have this piece of the puzzle.

Was it helpful?

Solution

You seem to assume correct. All the drawing code should be the same drawing to render buffer as to an attached texture, even shaders.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top