<div dir="ltr"><div><div>HI Michael,<br><br></div>It looks like you are over complicating things - creating and destroying views it almost certainly not the way to do it, most likely you'll want a solution that uses an osg::Camera in the scene graph or attached as a slave Camera that has it's RenderOrder set to PRE_RENDER.  You can use a NodeMask or Switch to toggle on/off such Camera's so have them only rendered when needed.  Another approach might be to use a RealizerOperation.<br><br>Could you roll back a little in your explanation of what you are trying to achieve so we can provide advice on how best to achieve it.  Specifically, what is that you need to do in your pre-processing?   <br><br></div><div>Robert.<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 25 August 2015 at 11:59, Michael May <span dir="ltr"><<a href="mailto:michael_beham@gmx.net" target="_blank">michael_beham@gmx.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I want to add a pre-processing step for rendering several environment maps. The environment maps are used for rendering the scene later.<br>
How does it work?<br>
<br>
Using multiple (composite)viewers does not work. So, I create a view for preprocessing. The view is then rendered using frame().<br>
After render the preprocess view, I remove it and create the view for rendering the scene. Note, both views has several camera slaves.<br>
<br>
<br>
Code:<br>
<br>
//Scene Loading, creating cameras, and so on<br>
...<br>
osg::ArgumentParser psr(&argc, argv);<br>
osgViewer::CompositeViewer* viewer2 = new osgViewer::CompositeViewer(psr);<br>
<br>
osgViewer::View* view2 = new osgViewer::View();<br>
view2->setCamera(m_camera2);<br>
view2->setSceneData( scene_obj);<br>
scene_manager->createPreprocess(graphic_context, view2); //Creates camera slaves for pre-processing<br>
viewer2->addView(view2);<br>
viewer2->frame();<br>
viewer2->removeView(view2);<br>
<br>
osgViewer::View* view = new osgViewer::View();<br>
view->setCamera(m_camera);<br>
view->setSceneData( scene_obj);<br>
<br>
scene_manager->setSlaveCameras(view, graphic_context); //creates camera slaves for scene rendering<br>
<br>
//Add Event Handler and so on...<br>
...<br>
<br>
while(!viewer2->done())<br>
{<br>
if(!view->getCameraManipulator() && view->getCamera()->getAllowEventFocus())<br>
view->setCameraManipulator(new osgGA::TrackballManipulator());<br>
viewer2->setReleaseContextAtEndOfFrameHint(false);<br>
if(_firstFrame)<br>
{<br>
view->init();<br>
if(!viewer2->isRealized())<br>
viewer2->realize();<br>
<br>
_firstFrame = false;<br>
}<br>
<br>
viewer2->advance(USE_REFERENCE_TIME);<br>
viewer2->eventTraversal();<br>
viewer2->updateTraversal();<br>
viewer2->renderingTraversals();<br>
}<br>
<br>
<br>
<br>
<br>
<br>
<br>
This technique works, but the frame-rate decreses dramatically.<br>
Does anybody have an idea?<br>
<br>
Thank you!<br>
<br>
Cheers,<br>
Michael<br>
<br>
I am using Osg 3.4 rc-2 with GL3.0 profile.<br>
Code:<br>
<br>
<br>
<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=64889#64889" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=64889#64889</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div><br></div>