Hi guys, We're having the same problem here. Textures are corrupted or are showing the wrong image when the viewer is destroyed and re-created. I've been tracking it for a week now. Here is the simplified core logic of the application that shows the problem.
For (;;) { { osgViewer::Viewer viewer(); viewer.setSceneData(scene_data); viewer.run(); scene_data->releaseGLObjects(); osgDB::Registry::instance()->releaseGLObjects(); } /* do other stuff */ } - The problem appears randomly, it's not deterministic. - The problem appears on all kind of different hardware. - Destroying all the osg::Texture objects in scene_data after run() (and re-creating them before run()) seems to solve the problem (note osgText still appears corrupted. - Only the textures that were shown during the last frame are corrupted; all other textures are fine. I've noticed something really strange once. The debugger stopped with an assert on an invalid iterator usage. It happened in the graphics thread, doing the culling. What puzzled me is that the graphic thread was still running while the main thread is already in the viewer destructor (thereby causing the culling to iterate over a scene that is no longer valid). In fact the graphic thread was actively running and doing culling/drawing after viewer.run() had exited. Robert, could you confirm that the rendering thread is not supposed to be actively culling/drawing when being outside of Viewer::run() (or more precisely, Viewer::frame())? >From what I understand from Texture.cpp and Texture2D.cpp, if the graphic thread were to be still running after calling releaseGLObjects(), the osg::Texture objects would re-create an osg::Texture::TextureObject (containing the actual OpenGL texture object) and be left in a state where they think they have a valid TextureObject. This would explain quite a lot. Cheers, Tanguy -----Original Message----- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Juan Casanueva Sent: 04 May 2009 17:21 To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] osgText texture not reloading correctly the secondtime? Hi JS, I think I have exactly the same problem you are having. I have an application that opens/closes a osg viewer. When I close the osg viewer, everything gets deleted, even the viewer. However, when I open the viewer the second time, some of the textures do not appear. This seems to be happening at random, since the textures that disappear are not the same ones every time. Sometimes its the terrain textures, sometimes the clouds, sometimes the 3d models (.ac)... I must say that the problem does not happen every time on my application. It happens from time to time, although if I open/close the viewer 3 or 4 times I eventually end up seeing the problem. I have no idea what is causing this problem, so I can't really help:( Just to let you know that it is not happening only on your application :) regards Juan ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=11304#11304 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org