[osg-users] How to use frame buffer object in existing (not osg) window and pipeline.
Han Hu
huhan8807 at gmail.com
Fri Feb 17 19:54:29 PST 2017
Hi,
I know OSG viewer can render into other window as shown in the glutviewer and sdl viewer example. But I do not know how to use fbo for this kind of work. The following code describes my purpose.
Code:
osg::ref_ptr<Viewer> viewer;
/* The vierwer is properly set up for other window*/
FrameBufferObject fbo;
/* The fbo is properly initilize with color and depth texture attachment and bind to a FBO object. And the fbo class have access to the texture object and will be used for image based rendering technic*/
/* The rendering loop */
void draw()
{
// only repaint the whole scene when needed, because my scene is rather static and heavy,
// draw fewer things
if(dragging){
fbo.bind();
/* draw a fewer things into fbo*/
viewer.frame();
fbo.unbind();
}
/* Draw heavier things */
if(need_repaint)
{
fbo.bind();
viewer.frame();
fbo.unbind();
}
/* Do some post processing with fbo, e.g. eye dome lighting, which is a image based rendering techniqe */
{
/* filtering */
filter(fbo);
}
/* blit the fbo onto backbuffer */
fbo.blit();
swapbuffer();
}
So my question is how to do this kind of fbo processing in OSG, because after investigate osg framebufferobject, I find the logic is not like this and a little confuse to understand.
Thank you!
Cheers,
Han
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70240#70240
More information about the osg-users
mailing list