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

Thread: Blending two frame buffers!

Hybrid View

  1. #1
    Newbie Newbie
    Join Date
    Jun 2013
    Posts
    3

    Blending two frame buffers!

    How to blend two frame buffers in OpenGL?
    Let the first one be the default frame buffer (either front or back) and the second one be an overlay buffer. These two frame buffers need to get blended.
    Please respond to this query.

  2. #2
    Junior Member Newbie Hannibal's Avatar
    Join Date
    Sep 2012
    Posts
    9
    Just an idea:
    You could use two 2D squares that fit your screen size, assign a texture to each and render into those textures.
    When you render the two squares with their textures enable blending.

  3. #3
    Member Regular Contributor
    Join Date
    Jun 2013
    Posts
    474
    Quote Originally Posted by Hannibal View Post
    Just an idea:
    You could use two 2D squares that fit your screen size, assign a texture to each and render into those textures.
    When you render the two squares with their textures enable blending.
    If you only need the sort of blending provided by glBlendFunc(), you can render one image directly to the framebuffer and the other into a texture, then render the texture onto the existing framebuffer with blending.

    If you don't have render-to-texture (glFramebufferTexture), you'll have to render into the framebuffer then copy the data to a texture with e.g. glCopyTexImage2D().

  4. #4
    Junior Member Newbie Hannibal's Avatar
    Join Date
    Sep 2012
    Posts
    9
    Quote Originally Posted by GClements View Post
    If you only need the sort of blending provided by glBlendFunc(), you can render one image directly to the framebuffer and the other into a texture, then render the texture onto the existing framebuffer with blending.
    You are right. One texture is enough to blend it with the default frame buffer.

  5. #5
    Junior Member Newbie
    Join Date
    Jun 2013
    Posts
    25
    Perhaps I'm doing things the round about way but I've found it useful to attach a framebuffer to the rendering of a screen aligned quad. Now you may composite several FBO's together using multi-texturing and capture the result as another texture.

  6. #6
    Newbie Newbie
    Join Date
    Jun 2013
    Posts
    3
    Thank you. We are rendering the object to a user defined frame buffer as a color attachment texture and blending it with the default frame buffer. But we have some confusion regarding the blending function.

Posting Permissions

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