Jump to content
  • Advertisement
Sign in to follow this  
ade-the-heat

fbo and shaders-an fbo for each shader?

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

So for my shaders is it good practise to use an FBO for each shader or just one FBO for all the shaders ? Also, if I call glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, texture_target, y_newTexID, 0); How can I "unattach" the color attachment so that the FBO no longer uses it ? regards

Share this post


Link to post
Share on other sites
Advertisement
My gut feeling is it depends on what you are doing. I know using one FBO with multiple attachments is the way to go for speed. But using more than one FBO has it's places also. Just try and see which way is faster for your situation.

Have you tried

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
and
glBindTexture(GL_TEXTURE_2D, 0);

Share this post


Link to post
Share on other sites
Quote:
Original post by ade-the-heat
So for my shaders is it good practise to use an FBO for each shader or just one FBO for all the shaders ?

like MARS_999 said, one FBO with multiple attachments is best for speed. However all color attachments need to have the same resolution and internal format. This may cause some problems.

For instance, blending only works with 16 bit textures. So if you got an FBO whose color attachments are all 32 bit, you'll need another FBO with 16 bit textures.

It's always a good idea to use as few FBO's as possible, since switching FBO's is *slow*.

Share this post


Link to post
Share on other sites
Quote:
Original post by Shai
It's always a good idea to use as few FBO's as possible, since switching FBO's is *slow*.
But weren't FBO invented to save the attachment validation overhead? I have tried doing three attachments VS three FBOs and the performance were similar so I'm not sure, I believe I've read it somewhere (there's something about it in the spec but it's spread here and there) and it seems to make sense.

Share this post


Link to post
Share on other sites
switching FBOs is faster than switching contexts (as with pbuffers) however it is the slowest method of using FBOs.

In order of speed;

- multiple textures attached; change render buffer to render to different texture
- single texture attached; change texture attachement to render to different texture
- multiple fbos; swap fbos to render to different texture


Information on how to 'unattach' colour attachments from FBOs is covered both in the spec and the fbo articles I wrote; and Mars's reply regarding that was totally wrong (glBindTexture(GL_TEXTURE_2D, 0) probably doesn't do what you expect either...)

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!