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

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.

[QUOTE=Christoph.LGDV;1284814]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?[/QUOTE]

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/html/glBlitFramebuffer.xhtml

before you call that, bind your G-buffer as source for read operations and the default framebuffer (screen) as destination for draw operations:

glBindFramebuffer(GL_READ_FRAMEBUFFER, gbuffer);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);

then specify the attachment you want to read from, e.g.:

glReadBuffer(GL_COLOR_ATTACHMENT0);

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

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