Hi Robert,

I finally got around to getting the 2.6.0 build and tested it out again. Unfortunatly, the OPTIMIZE_TEXTURE_SETTINGS
flag still causes problems.

As stated below, the problem is if you optimize your scene graph using the OPTIMIZE_TEXTURE_SETTINGS setting, then recycle the context id, textures are missing.

Thanks,
Brett

Robert Osfield wrote:
Hi Brett,

We've done work since 2.4.0 to address this issue, could you please
try 2.5.5 or the svn/trunk.

Cheers,
Robert.

On Thu, Jul 17, 2008 at 9:31 PM, Brett Wiesner <[EMAIL PROTECTED]> wrote:
Hi,

Problem:
Using OSG 2.4.0 I have built an app that dynamically creates composite
viewers that have one of more views. The scene graph is kept around as a ref
pointer during the course of multiple viewers. When I delete a composite
viewer and create another one and then use the original root node of the
scene graph, textures are gone (ie, everythings white).

I've tracked the problem down to this. If you optimize your scene graph
using the OPTIMIZE_TEXTURE_SETTINGS setting, then recycle the context id,
textures are missing.

I'm honestly not sure what the optimizer option OPTIMIZE_TEXTURE_SETTINGS
does but I can reproduce the bug.

I've included sample code below to reproduce the bug.

Thanks,
Brett


// This method reads in a flt file and writes it out optimized using the
"troublesome" flag.
 writeOutModelAsIveOptimized()
 {
    std::string modelPath = testDataDir();
    modelPath += "testTree\\Test_tree.flt";

    std::string modelPathOut = testDataDir();
    modelPathOut += "testTree\\Test_tree_optimized.ive";

    // create a scene graph (and keep it around).
    osg::ref_ptr<osg::Node> modelNode = osgDB::readNodeFile(modelPath);
    osgUtil::Optimizer op;

op.optimize(modelNode.get(),osgUtil::Optimizer::OPTIMIZE_TEXTURE_SETTINGS);

    osgDB::writeNodeFile(*modelNode.get(), modelPathOut);
 }

// This method reads in a flt file and writes it out unoptimized. Please
substitute any flt file you have.
 writeOutModelAsIve()
 {
    std::string modelPath = testDataDir();
    modelPath += "testTree\\Test_tree.flt";

    std::string modelPathOut = testDataDir();
    modelPathOut += "testTree\\Test_tree_unoptimized.ive";

    // create a scene graph (and keep it around).
    osg::ref_ptr<osg::Node> modelNode = osgDB::readNodeFile(modelPath);
osgDB::writeNodeFile(*modelNode.get(), modelPathOut);
 }


// This method creates a scene graph and keeps it around after the
destruction of a viewer.
// Then it creates a viewer and loads the model. You try this with both the
unoptimized ive and the
// optimized one. It runs the viewer waits for you to look at the model and
then hit esc to quit.
// Then it destroys the viewer, and creates another one using the same scene
graph.
// You'll notice that the scene no longer has textures.
 TEST(test_osgKeepSceneGraphAround)
 {
    std::string modelPath = testDataDir();
    modelPath += "testTree\\Test_tree_optimized.ive";

    // create a scene graph (and keep it around).
    osg::ref_ptr<osg::Node> modelNode = osgDB::readNodeFile(modelPath);

    // create viewer1 and set the scene graph data.
    osgViewer::Viewer* viewer1 = new osgViewer::Viewer;
    viewer1->setUpViewOnSingleScreen(0);
    viewer1->setSceneData(modelNode.get());
    viewer1->setCameraManipulator(new osgGA::TrackballManipulator());

    // render
    viewer1->realize();
    while(!viewer1->done())
    {
       viewer1->frame();
    }

    // delete viewer1.
    delete viewer1;
    viewer1 = 0;

    // create viewer2 and set the scene graph data.
    osgViewer::Viewer* viewer2 = new osgViewer::Viewer;
    viewer2->setUpViewOnSingleScreen(0);
    viewer2->setSceneData(modelNode.get());
    viewer2->setCameraManipulator(new osgGA::TrackballManipulator());

    // render
    viewer2->realize();
    while(!viewer2->done())
    {
       viewer2->frame();
    }

    // delete viewer2.
    delete viewer2;
    viewer2 = 0;
}
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to