Login  Register

Re: FBOs and Shaders

Posted by Sven Gothel on Feb 13, 2014; 2:08pm
URL: https://forum.jogamp.org/FBOs-and-Shaders-tp4031557p4031570.html

On 02/13/2014 05:46 AM, bgroenks96 [via jogamp] wrote:
> This is probably more of a general OpenGL question than just JOGL, but I'm
> trying to figure out how to get my shaders to render to the currently bound FBO?

Simply by binding the FBO, i.e. FBObject.bind(GL gl):
    if(samples > 0 && fullFBOSupport) {
        // draw to multisampling - read from samplesSink
        gl.glBindFramebuffer(GL2ES3.GL_DRAW_FRAMEBUFFER, getWriteFramebuffer());
        gl.glBindFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER, getReadFramebuffer());
    } else {
        // one for all
        gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, getWriteFramebuffer());
    }

Look at our unit test demo code: FBOMix2DemosES2.

~Sven



signature.asc (894 bytes) Download Attachment