Re: [osg-users] How to use frame buffer object in existing (not osg) window and pipeline.
Hi Robert, Thanks for your suggestion, I understand the bettter way is to use osg in all the pipeline. But the ugly fact is that I have to use existing pipeline and inject the view.frame() inside a fbo binding, and hope osg will draw the things onto the fbo texture and depth. Because I can't make others change to osg. And the reasons I have to inject osg into existing pipeline is that I have to load an pagelod data into the scene (some osgb data). And I have successfully do this in the viewerglut example. Otherwise I have to reinventing the big wheel . Thank you! Cheers, Han -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=70275#70275 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to use frame buffer object in existing (not osg) window and pipeline.
HI Han, The OSG has a sophisticated support for multiple pass rendering built into the scene graph itself, tjhere is no need to mix viewer code with multi-pass rendering in the way you are doing. I would recommend against conflating viewer and low level rendering of the scene as it limits the flexibility of your appication to handle new rendering techniques - as you will have hardwired in the rendering technique at the application level. There are number of multiple pass examples that the OSG provides, see osgdistortion, osghud, osgprerender, osgprerendercubemap. Robert On 18 February 2017 at 03:54, Han Hu wrote: > 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; > /* 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 > > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to use frame buffer object in existing (not osg) window and pipeline.
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; /* 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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org