Jump to content
  • Advertisement
Sign in to follow this  

Do I Need / Should I Have more than one FBO?

This topic is 3086 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

I'm reading the framebuffer 101 tutorial here on gamedev and it says I first make an FBO and attach textures and depth buffers to that. Do I only need one FBO or is there an advantage to having more?

Also, do I need to use EXT or not? (ie glBindFramebufferEXT() vs glBindFramebuffer().)

[Edited by - whiterook6 on July 7, 2010 10:54:42 PM]

Share this post

Link to post
Share on other sites

since you can attach multiple textures to one FBO you can go with one.
In fact I came across some problems using more FBO´s and switching from one to another. It seems that some drivers under Vista / 7 have massive problems with switching the entire FBO. I encountered this when pingpoing FBO´s for filtering purposes.
But as I said in the beginning since you can attach / detach textures to a FBO you can avoid that.

Hope that helped,


Share this post

Link to post
Share on other sites
If glBindFramebuffer() is available, glBindFramebufferEXT() should not be necessary.

Generally EXT means this is an extension provided by multiple implementors but is not necessarily available everywhere. Methods without the EXT (or ARB) suffix were promoted to core OpenGL in some version, so if your target OpenGL version is high enough and the method is not deprecated (which should not be the case for FBO related stuff any time soon) I'd suggest you use the version without EXT.

Wrt. having multiple FBOs or not: it depends on what you want to do. If one FBO is sufficient then fine, but I guess in most cases you'd need multiple ones.
Edit: if the attached textures should have different bit-depths (e.g. 4x8, 2x16, 4x16 etc.) or different dimensions, you might need to create different FBOs.

Edit2: from the OpenGL wiki:

Is it better to make 1 FBO and bind your texture to it each time you need to render to the texture?
An FBO itself doesn't use much memory. It is a state vector object. In terms of performance, each time you bind, the driver needs to validate the state which costs CPU time. Logically, it would be better to have 1 FBO per Render_To_Texture (RTT).
However, it has been found that you get a speed boost if your textures is the same size and you use 1 FBO for them.
If you have 10 textures that are 64x64 and 10 textures that are 512x64, make 2 FBOs. One FBO for each group.

Share this post

Link to post
Share on other sites

So I can have more than one depth buffer as well as more than one color buffer?
Not really.

WRT one versus two, depends. Rule: use one, unless you're trying to feed the FBO's output back into itself as a texture.

Generally, these scenarios only arise when doing iterative feedback (like for cloth, particle, fluids, etc. simulation). Most purposes, where the texture is never reused by the FBO, (like in shadowmapping, for instance), a single FBO suffices.

To do ping-ponging, after doing the operation, instead of passing the FBO's output to itself each cycle, you pass it to a second, identical FBO and do the operation there. When this FBO outputs a texture, you can send the texture back to the first FBO to do the operation.

define two identical FBOs "FBO1" and "FBO2"
Use texture from FBO2
Do operation

Use texture from FBO1
Do operation


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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!