Hi

I ended up having to call getGraphicsContext()->close(false) myself due to 
cameras disapperaing from the canvas before the canvas was deleted. However, I 
still have the same problem with the textures not being correct the second time 
I create the window. A way to make it work is to comment out the line:

getTextureObjectManager()->_textureObjectListMap[contextID].push_back(_textureObjectBuffer[contextID]);

in void Texture::releaseGLObjects(State* state) const.

Any ideas what I'm doing wrong?

/Christer

-----Ursprungligt meddelande-----
Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För Robert Osfield
Skickat: den 7 december 2007 13:13
Till: OpenSceneGraph Users
Ämne: Re: [osg-users] Textures disappear when removing and adding views

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
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to