Sign in to follow this  

FBO endless loop ?

This topic is 4168 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 am using a Frame Buffer Object to render a portion of each frame to an off-screen texture for application of special FX. What I'd like to know is whether the following is valid (on all chipsets?) 1) Bind FBO and associated texture, say "tex" 2) Render scene (to "tex" texture) 3) render "tex" as fullscreen quad, applying blend or shader 4) repeat step 3 a couple of times. It seems that this works fine on Nvidia chipsets, but causes the game to lock up on ATI chipsets. I understand that what I'm doing is probably not standard, and I'm wondering whether having the texture be the source and destination of the same rendering pass is causing an endless loop on ATI chipsets? Thanks, G

Share this post


Link to post
Share on other sites
from http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt

"""

(44) What should happen if a texture that is currently bound to the
context is also used as an image attached to the
currently bound framebuffer? In other words, what happens if a
texture is used as both a source for texturing and a
destination for rendering?

RESOLUTION: resolved, (b2) - results are undefined because
the framebuffer is not "framebuffer complete".

Originally this was resolved as causing framebuffer to fail
the completeness test--i.e., rendering would be disabled (b1)

As background, the reason this is an issue in the first
place is that simultaneously reading from, and writing to,
the same texture image is likely to be problematic on
multiple vendors' hardware without paying performance
penalties for excessive synchronization and/or data copying.
"""
go to the link and you can read the rest...

Share this post


Link to post
Share on other sites
In other words, you can use the FBO as a texture after you render to it in the same frame. That's the main point of FBOs. You can't use one as a texture while rendering to the same one. If rendering to it and then using it as a texture is not working, you are most likely doing something wrong. Post some code.

Share this post


Link to post
Share on other sites
The solution is to use two textures and 'ping-pong' between them.

1. Attach texture 1 to FBO
2. Render image into FBO (with texture 1)
3. Bind texture 1
4. Attach texture 2 to FBO
5. Render quad using texture 1 into FBO (with texture 2)
6. Bind texture 2
7. Attach texture 1 to FBO
8. Render image into FBO (with texture 1)
6. Bind texture 1
9. Attach texture 2 to FBO
10. Render image into FBO (with texture 2)
.
.
.

Share this post


Link to post
Share on other sites

This topic is 4168 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this