Hi Himar, Performance wise I would very strongly recommend against resizing an FBO per frame as performance will be atrocious. If you can create a region big enough to cover the largest you'll ever need then just use a viewport resize to extract a subwindow from it. I don't know if the internals will cope with this, but at least perform OK as there won't be any need to recreate the FBO.
Robert. On Nov 30, 2007 6:20 PM, Himar Carmona <[EMAIL PROTECTED]> wrote: > Hi, > > i'm using FBO to render offscreen and i have found a little problem when i > need to resize the target object. > > i have the following scenario: > > 1. I set up a camera to use FRAME_BUFFER_OBJECT (as osgprerender). > 2. I attach an Image to it with camera.attach (leaving OSG to control de > RenderBuffer object). > 3. I render once. (viewer.frame()). > 4. I take a snapshot of the image using osgDB.writeImageFile > > Until here all runs ok. I have a pretty file with the rendered frame as > expected. But since i want to be able to resize the target (Image) between > frames render, i do next the following: > > 5. Simulate a resizing (growing up), changing the image size (hence > changing the internal buffer) or creating a new Image with different size. > 6. setting Viewport from the camera to the desired size. > 7. I attach the new image to the camera (or the original resized one). > 8. I render once again. (viewer.frame()). > 9. I take a snapshot of the image. > > The problem is that the internal FBO that RenderStage controls doesn't > notice the attachment's change, and therefore doesn't call > fbo.setAttachment, so what i have in the second > snapshot (step 9) is only a piece of the image rendered. > > If i have understand correctly the framebuffer_object spec, it says that > the FBO doesn't have sizing fields internally, and the final size is > governed by the attachment (here the image). > > I 'feel' that renderstage only calls fbo.setAttachment when the fbo is > initialized. If this where the case, then how can i force RenderStage to > reattach the fbo without creating it again? I will > try to use the fbo.dirtyAll, but first i must realize how can i get at it. > > Of course, i also could have missed something. I have a test code with the > problem, so if it must be tested, i can upload it. > > Another side effect of renderstage (independent for this problem) is that > it also attach another renderbuffer to the depth_component internally, with > or without being said. Is this avoidable? > > Thanks. > Himar. > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

