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 3 of 3

Thread: glBlitFramebufferEXT

  1. #1
    Intern Contributor
    Join Date
    Aug 2009
    Posts
    53

    glBlitFramebufferEXT

    I have an offscreen framebuffer which I blit to the primary framebuffer using
    glBlitFramebufferEXT(0, 0, width,height,
    0, 0, windowWidth, windowHeight,
    GL_COLOR_BUFFER_BIT ,
    GL_NEAREST);

    This works fine when width and height equals windowWidth and windowHeight, but if they are off by just a single pixel, then it fails with invalid operation. I am using the offscreen fbo to let the visible window rescale while keeping the offscreen rendering constant in size, so this is a big problem for me now.

    I have previously been blitting from the offscreen fbo to the primary with different size and it worked just fine. After rewriting the fbo creation to multisampling (now using renderbuffers rather than textures) it has the size requirement which it didn't have before.

    glGenFramebuffersEXT(1, &fboID);
    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboID);
    glGenRenderbuffersEXT(1, &ColorBufferID);
    glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorBufferID);
    glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFE R_EXT, 8, GL_RGBA8, width, height);
    glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, ColorBufferID);

    Is there anything in my framebuffer creation which makes it unable to rescale pixel data when blitting? According the the specks, this should work just fine, but it doesn't. Any pointers would be greatly appresiated.

    EDIT: currently primary frame buffer is non multisample while the offscreen has been anything from 0 to 16

  2. #2
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    676

    Re: glBlitFramebufferEXT

    Spec:

    If either the draw or read framebuffer is framebuffer complete and
    has a value of SAMPLE_BUFFERS that is greater than zero, then the
    error INVALID_OPERATION is generated if BlitFramebufferEXT is called
    and the specified source and destination dimensions are not
    identical.

  3. #3
    Intern Contributor
    Join Date
    Aug 2009
    Posts
    53

    Re: glBlitFramebufferEXT

    Hm, I missed that part, it seems.
    Could it be written any clearer? ;-)

    The solution is then to have TWO offscreen buffers? one with multisampling and one without, but both with same size. Blit from the one with multisample to the one without and then to the default framebuffer, or is there a simplere generic solution?

Posting Permissions

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