Hi Michel,

The crash is down to you using a C pointer to an object that is being
deleted from memory so its now just a dangling pointer.  Using a
ref_ptr<> to the View will keep the view from being destroyed.

As Miguel suggest, you can temporary switch off a view by doing:

 view.getCamera()->setNodeMask(0x0);

Robert.

On 7/8/07, Michel van Elk <[EMAIL PROTECTED]> wrote:
Hi,

Depending on a user-controlled layout I'd like to enable/disable certain
views in a compositeviewer.
That way I can switch between a single view, 2x2 views etc.

I can disable views by setting their viewport to (0,0,0,0) but I assume this
will make them
render anyway, loosing performance to useless tasks.

So I've tried to dynamically add/remove the views from/to the
compositeviewer, depending on
which layout the user chooses. Now here some problems occur. When I remove a
view from the
compositeviewer its camera is somehow destroyed or corrupted.

My code is like this:

//first initialize the compositeviewer with some views, this works OK

//get the camerapointer from fist view, works OK!
osg::Camera *cam1=m_pView[0]->getCamera();

//now remove the view from the compositeviewer
m_pCompositeViewer->removeView(m_pView[0]);

//ask for the camerapointer again, now I get an invalid pointer!
osg::Camera *cam2=m_pView[0]->getCamera();

Can anyone explain this behaviour? Is it logical that camera's are thrown
away if views are
not used anymore by a viewer?

Is there another way to temporarily disable views?

Thanks for any help!

Michel


_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to