<div dir="ltr"><div class="gmail_extra"><br></div><div class="gmail_extra">Hello,<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 9:57 AM, Sophie Audonneau <span dir="ltr"><<a href="mailto:sophie.audonneau1@etu.univ-lorraine.fr" target="_blank">sophie.audonneau1@etu.univ-lorraine.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div id=":24a" class="" style="overflow:hidden">In my draw function I have to do the following :<br>
viewer_->setUpViewerAsEmbeddedInWindow(viewParams[0],viewParams[1],viewParams[2] ,viewParams[3]);<br>
viewer_->getCamera()->setProjectionMatrix( osg::Matrix(glMat_projection) );<br>
viewer_->getCamera()->setViewMatrix( osg::Matrix(glMat_modelview) );<br>
viewer_->frame();</div></blockquote></div><br></div><div class="gmail_extra">You are not supposed to do this on every frame, unless you are changing them all time. Are you doing some sort of augmented reality where they are provided by the tracking system? In a typical OSG application the matrices are typically set only once (or not at all - use the default!), the view matrix is often driven using a camera manipulator. The only thing you should do periodically is viewer_->frame(). <br><br></div><div class="gmail_extra">I think your problem is that you are calling setUpViewerAsEmbeddedInWindow() on every frame - this sets the viewer up from scratch each time. There is no need to do that - you do it only once when you are creating the window. <br><br>Please, have a look at the examples that ship with OSG. They show how to use OSG and how to integrate it with other libraries (which is what I assume you are doing, since you are calling setUpViewerAsEmbeddedInWindow() yourself). <br><br></div><div class="gmail_extra">Re adding/removing nodes - that is perfectly fine, just do it before or after running the viewer_->frame() call, not in some sort of callback or separate thread.<br><br></div><div class="gmail_extra">J. <br></div><div class="gmail_extra"><br><br><br><br><br></div></div>