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: OpenGL Compute modify GL_BACK

  1. #1

    OpenGL Compute modify GL_BACK

    Hi,

    I want to display the G-BufferContents on screen (or anything at all) using a GL Compute Shader.


    Is it by now possible to bind the backbuffer as an image?
    Or is there an alternative solution?


    Best Regards
    Christoph

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,002
    Quote Originally Posted by Christoph.LGDV View Post
    Is it by now possible to bind the backbuffer as an image?
    No. Only textures may be bound as images, so you'll need to render or blit the texture to the default framebuffer.

    Note that while EGL allows you to bind an EGLSurface as a texture, this only works for pbuffer surfaces, not window surfaces.

  3. #3
    Member Regular Contributor
    Join Date
    May 2016
    Posts
    467
    Quote Originally Posted by Christoph.LGDV View Post
    I want to display the G-BufferContents on screen (or anything at all) using a GL Compute Shader.

    Is it by now possible to bind the backbuffer as an image?
    Or is there an alternative solution?
    i assume your "Gbuffer" is a framebuffer object with some texture or renderbuffer attachments
    you dont need compute shaders for that, just blit your (G-)framebuffer content into the default framebuffer (screen)

    https://www.opengl.org/sdk/docs/man/...mebuffer.xhtml

    before you call that, bind your G-buffer as source for read operations and the default framebuffer (screen) as destination for draw operations:
    Code :
    glBindFramebuffer(GL_READ_FRAMEBUFFER, gbuffer);
    glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);

    then specify the attachment you want to read from, e.g.:
    Code :
    glReadBuffer(GL_COLOR_ATTACHMENT0);

    then call glBlitFramebuffer(...) to copy the G-framebuffer content into the default framebuffer (screen)

  4. #4
    Thank you for your replies.

    I was wondering if there was a hack, similar to the Direct3D solution where i can get the required pointers.

    @john_connor why would I want to blit a GBuffer to my framebuffer, it is sensible to render the deferred lighting directly to framebuffer0

Posting Permissions

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