Hello, On Tue, Apr 14, 2015 at 9:57 AM, Sophie Audonneau < sophie.audonne...@etu.univ-lorraine.fr> wrote:
> In my draw function I have to do the following : > viewer_->setUpViewerAsEmbeddedInWindow(viewParams[0],viewParams[1],viewParams[2] > ,viewParams[3]); > viewer_->getCamera()->setProjectionMatrix( osg::Matrix(glMat_projection) ); > viewer_->getCamera()->setViewMatrix( osg::Matrix(glMat_modelview) ); > viewer_->frame(); > 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(). 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. 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). 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. J.
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org