Hi Michel
Could you tell us what type is m_pView? is it a ref_ptr list or just a
pointer list?
Cause if it s only a pointer list, your view will be destroyed after that
you removed it from the composite viewer ( this is the behavior of ref_ptr
inside the composite view)
You should use ref_ptr if you dont already.
If this helps you please let us know

Benjamin

2007/7/8, Michel van Elk <[EMAIL PROTECTED]>:

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