Hi all,
I've recently updated our version of OpenSG to the current svn version and
we're experiencing a problem when we try to re-open a project (destroy the
whole scene
and the window and create a new one).
The problem occurs right when we call init() method of the PassiveWindow,
immediately after re-creating it.
Tracking the error lead us to the following call stack:
msvcr80d.dll!strlen(unsigned char * buf=0x0012f9d4) Line 81 Asm
msvcp80d.dll!std::char_traits<char>::length(const char *
_First=0x00000000) Line 559 + 0x9 bytes C++
msvcp80d.dll!std::basic_string<char,std::char_traits<char>,std::allocator<char>
>::assign(const char * _Ptr=0x00000000) Line 1080 + 0x9 bytes C++
OSGSystemD.dll!OSG::Window::setupGL() Line 1889 + 0x2d bytes C++
OSGSystemD.dll!OSG::Window::init(boost::function<void
__cdecl(void),std::allocator<void> > oFunc={...}) Line 2280 + 0x12 bytes
C++
The first time init() is called, everything works fine.. however the problem
occurs if we try to re-create the window.
To assure ourselves we weren't doing anything wrong, we created a small
program based on the simple example of yours (hello01.cpp)
that creates a simple scene, and by pressing a key, destroys the window and
re-creates it (along with the scene).
The exact same error occurs (as listed above by the call stack).
The folowing code are the modifications of the example ( hello01.cpp )
stated above:
void createScene()
{
// create the scene
OSG::NodeUnrecPtr scene = OSG::makeTorus(.5, 2, 16, 16);
OSG::commitChanges();
// create the SimpleSceneManager helper
mgr = new OSG::SimpleSceneManager();
// tell the manager what to manage
mgr->setWindow( gwin );
mgr->setRoot ( scene );
}
OSG::GLUTWindowTransitPtr createWindow()
{
gwin = OSG::GLUTWindow::create();
return OSG::GLUTWindowTransitPtr( gwin );
}
void destroyScene()
{
gwin = 0;
delete mgr;
mgr = 0;
}
// Initialize GLUT & OpenSG and set up the scene
int main(int argc, char **argv)
{
// OSG init
OSG::osgInit(argc,argv);
// GLUT init
glutid = setupGLUT(&argc, argv);
// the connection between GLUT and OpenSG
gwin = createWindow();
gwin->setGlutId(glutid);
gwin->init();
createScene();
// show the whole scene
mgr->showAll();
// GLUT main loop
glutMainLoop();
return 0;
}
// react to keys
void keyboard(unsigned char k, int x, int y)
{
switch(k)
{
case 27:
{
// clean up global variables
destroyScene();
OSG::osgExit();
exit(0);
}
break;
case 's':
{
mgr->setStatistics(!mgr->getStatistics());
}
case 'r': // rebuild
destroyScene();
createWindow();
gwin->setGlutId(glutid);
gwin->init();
createScene();
mgr->showAll();
break;
}
}
Thanks, and best regards,
Pablo Elias
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users