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: Is this possible - Draw & resize BB to RT

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2010
    Posts
    7

    Is this possible - Draw & resize BB to RT

    Hi,

    Say for example I have a Back-Buffer the size of 2000x1000.

    In addition I have a render target (FBO) the size of 2000x1000.

    And say the Back-Buffer is multi-sampled (16).

    I want to blit the pixels from the back-buffer to the final render target, BUT - I want to copy the entire back-buffer frame to the upper-left quarter of the final render target.

    Meaning - I want to copy from the BB and shrink it by 4 when it's copied to the final render target.

    The problem is - this doesn't work and gives me an 'Invalid Operation' error.


    So what I did to bypass the error is -

    I've rendered to the 2000x1000 Back-buffer.

    Then I copied the pixels as they are to a TEMP render target 2000x1000 size.

    Then I copied & shrunk from the TEMP render target to the FINAL render target, and this works.


    Maybe you can't copy & shrink from the Multi-Sampled Back-Buffer to a non-multi-sampled final render target ?

    Is this true ?

    If not - I'd be happy to hear so ...

    Because this extra copy through the TEMP render target causes me some performance issues I cannot afford ...

    Thank you all in advance !

  2. #2
    Member Regular Contributor strattonbrazil's Avatar
    Join Date
    Jun 2007
    Location
    Los Angeles, CA
    Posts
    305

    Re: Is this possible - Draw & resize BB to RT

    It is possible according to the blit command. You might have some kind of mismatch in types and targets.

    http://www.opengl.org/registry/specs...uffer_blit.txt

    If the source and destination rectangle dimensions do not match,
    the source image is stretched to fit the destination
    rectangle. <filter> must be LINEAR or NEAREST and specifies the
    method of interpolation to be applied if the image is
    stretched. LINEAR filtering is allowed only for the color buffer;
    if <mask> includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT, and
    filter is not NEAREST, no copy is performed and an
    INVALID_OPERATION error is generated. If the source and
    destination dimensions are identical, no filtering is applied. If
    either the source or destination rectangle specifies a negative
    dimension, the image is reversed in the corresponding direction.
    If both the source and destination rectangles specify a negative
    dimension for the same direction, no reversal is performed.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2010
    Posts
    7

    Re: Is this possible - Draw & resize BB to RT

    There is no mention to the fact that the Back-Buffer is MULTI-SAMPLED, and the render target to which I want to copy is NOT MULTI-SAMPLED.

    Could that be what causes me the INVALID OPERATION ?

  4. #4
    Member Regular Contributor strattonbrazil's Avatar
    Join Date
    Jun 2007
    Location
    Los Angeles, CA
    Posts
    305

    Re: Is this possible - Draw & resize BB to RT

    No, blitting should take care of that. Here's a working example I use as reference. You can always try swapping in his values.

    http://blog.dexta.ch/2008/08/27/gl_e...buffer_object-
    with-multisampling/

Posting Permissions

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