Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: MRT efficiency to avoid useless rendering

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2006
    Posts
    20

    MRT efficiency to avoid useless rendering

    Hi,
    my app uses 1 FBO with 2 color attachments.

    the main loop alogorithm is basic :
    bind the mrt
    render the scene
    unbind
    render the scene (to GL_BACK).

    Unfortunatelly, I have a performance issue. A single render pass is very expensive and I would like to avoid one pass.

    The best solution would be to have a MRT with 3 attachments : GL_BACK and 2 GL_COLOR_ATTACHMENT.
    AFAIK, this is not possible : in glsl gl_FragData could only be used to write into a color_attachement and we can't use gl_FragData and gl_FragColor in the same time.

    Am I right ?

    If I am wrong
    PLEASE tell me how to do!!!
    else :

    So I can render my scene into 3 color attachements, and then copy the content of one fbo texture into GL_BACK.

    My goal is then to find the most efficient way to copy.

    The GL_EXT_framebuffer_blit extension provide the fastest copy from one fbo to another. Does a similar method exist to copy/swap a fbo texture to the back buffer ?

    The only way I know to do that would be to use a quad and use a texture on it.

    Is there a better solution ?

    thanks!

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    999

    Re: MRT efficiency to avoid useless rendering

    GL_EXT_framebuffer_blit also allows you to blit between an application created FBO and the window provided framebuffer.
    Just set GL_DRAW_FRAMEBUFFER_EXT to 0 if you want it to write to the window provided framebuffer.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2006
    Posts
    20

    Re: MRT efficiency to avoid useless rendering

    Great ! Thanks a lot!

    Is it possible to specify the color_attachement like that ?

    BindFramebufferEXT(READ_FRAMEBUFFER_EXT, 2);
    glReadBuffer(GL_COLOR_ATTACHMENT3_EXT);
    BindFramebufferEXT(DRAW_FRAMEBUFFER_EXT, 0);
    BlitFramebufferEXT(0, 0, 640, 480,
    0, 0, 640, 480,
    GL_COLOR_BUFFER_BIT,
    GL_NEAREST);

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    999

    Re: MRT efficiency to avoid useless rendering

    According to the spec this should be possible.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •