Jump to content
  • Advertisement
Sign in to follow this  
qp

How to use renderbuffers as FBO color attachments? [SOLVED]

This topic is 3715 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello gamedev I want to play around with postprocessing. I read about FBOs, both in the spec and in about a million tutorials all showing the same render-to-texture example with slight variations. Using a texture as destination seems not that sensible if my application's window size exceeds GL_MAX_TEXTURE_SIZE (and i'd have to deal with non-power-of-two textures). It seems a renderbuffer attached to the FBO as color attachment is the way to go. Unfortunately, i have no idea of how to access the renderbuffer's contents after rendering my scene into it and the spec doesn't mention that. Use a singe fullscreen Quad with a shader that accesses the renderbuffer(how?)? Somehow apply a shader onto the renderbuffer itself? And anyway i'd have to figure out how to do more than one postprocessing run (e.g. applying a gaussian first vertically then horizontally). Render from one renderbuffer into another, applying a fragment shader, repeat? It seems i'm pretty lost. any help appreciated, and thanks. [Edited by - qp on July 23, 2008 5:11:15 PM]

Share this post


Link to post
Share on other sites
Advertisement
>>Unfortunately, i have no idea of how to access the renderbuffer's contents after rendering my scene into it and the spec doesn't mention that.

I assume u have a texture attached to the FBO, in that case then all u need to do is bind that texture + draw something that accesses it.
ie u can ignore it came from FBO

Share this post


Link to post
Share on other sites
Quote:
Original post by zedzI assume u have a texture attached to the FBO


No, it is a renderbuffer. You can attach textures or renderbuffers to FBOs. The two are called "framebuffer attachable images" for that reason. I have now resorted to using textures like everybody else does, but i still think i am missing something. Renderbuffers must have some use besides being used as depth buffers. Anyway, since using textures works fine i consider the topic closed and will mark it accordingly in a few days if no new information surfaces.

Share this post


Link to post
Share on other sites
A renderbuffer is just for offscreen rendering just like p-buffers (WGL_ARB_pbuffer).
In the old days, if you wanted to take a screenshot, you risk getting bitten by the "pixel ownership" issue, so p-buffers were created. You render to the p-buffer and do a glReadPixels and save it as a jpeg or whatever format.
Then, the need for render to texture came along and they built an extension around p-buffers (WGL_ARB_render_texture).

Some years later, they finally came up with GL_EXT_framebuffer_object. This eliminates the problem of "contexts" and takes the job of both WGL_ARB_pbuffer and WGL_ARB_render_texture. It is also multiplatform.

PS: There was GLX_SGIX_pbuffer for Unixes. I don't know what Apple had.
There was no render to texture on Unix on think.

Share this post


Link to post
Share on other sites
ok I understand now,
renderbuffers do have some limitations, accessing the results later on is one of the limitations. (though textures dont have AA so they have limitations as well also RBs can use less mem/perhaps are faster)

perhaps have a look at GL_EXT_framebuffer_blit which lets u copy between FBOs or from a FBO to the mainscreen
but u wont be able to do multiple reads/accesses as you need here (e.g. applying a gaussian first vertically then horizontally)
in that case u have to bind a texture to the FBO, ie a renderbuffer doesnt cut it

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!