HI Christer,

The critical aspect to this issue is the adding removal of graphics
windows and scene graphs, rather than views.  If you have one view per
graphics window then they'll be matched, but this isn't always the
case.

What is happening to the graphics window in your case?  The intention
is that the GraphicsContext base class will issue a release of OpenGL
objects on any Camera's attached to it, this in theory should clean
the scene graphs attached to the Cameras so that any subsequent reuse
of the contextID won't affect things - it'll be treated like it starts
from scratch.   This can't be happening correctly in your case,
perhaps not happening at all.

As to why its not happening correctly I'm afraid I can't say, there at
lots of collaborating classes in play, and order of events is quiet
open.  The best I can do is point you in the direction of where to
stick some debugging code to better reveal what's happening.   My
first port of call would be to see whether the
src/osg/GraphicsContext.cpp's GraphicsContext::close() method is being
called, and if the code that does the releaseGLObjects is being called
for the scene graphs in question.

Robert.

On Dec 7, 2007 11:43 AM, Christer Wigren <[EMAIL PROTECTED]> wrote:
> Hi
>
> In our windows application we need to add and remove views during the 
> execution of the program. We are using wxCanvas and osgViewer::GraphicsWindow 
> (OSG 2.2) as basis for our canvas class. Many of the different views are 
> using the same scenedata. When we create a new window with a new canvas we 
> are using the init method from the osgviewerWX example which contains the 
> following line of code:
>
>    getState()->setContextID( osg::GraphicsContext::createNewContextID() );
>
> If we remove the view from the osgViewer::CompositeViewer and later create a 
> new view and add to the viewer then 
> osg::GraphicsContext::createNewContextID() are reusing an old contextID and 
> the textures are not set correctly. However, if we change the method so that 
> it does not reuse the contextID then everything works fine.
>
> I attach the changed file.
>
> /Christer
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to