Dear all,

first of all thanks for the great tool!

I'm porting my app to openSceneGraph. My environment:

KDE 4.4.5
QT4 4.6.3
gcc43-c++ 4.3.3

Running the demo app osgviewerQT works fine.

In my code I'm using the code of Adapterwidget together with QGLWidget.
Rendering runs perfect only the trackballManipulator doesn't do anything.

Digging into the code shows the following problem:

In Viewer::eventTraversal() there is this sequence of code:

//################# code #####################

    for(Contexts::iterator citr = contexts.begin();
        citr != contexts.end();
        ++citr)
    {
        osgViewer::GraphicsWindow* gw = 
                             dynamic_cast<osgViewer::GraphicsWindow*>(*citr);

// -------------------------My insertion !!! -------------------------
        if (!gw) {
            osg::notify(osg::WARN) << "eventTraversal() - gw = 0\n";
            if (!(*citr))
                osg::notify(osg::WARN) << "eventTraversal() - (*citr) = 0\n";
            else {
                osg::Object* obj = dynamic_cast<osg::Object*>(*citr);
                if (obj)
                    osg::notify(osg::WARN) << 
                               "eventTraversal() - (*citr)->className() = " <<
                               obj->className() << "\n";
            }
        }
// -------------------------End my insertion !!! -------------------------
        if (gw)
        {
            gw->checkEvents();

// ############### End of code ############################

The output I get is:
eventTraversal() - gw = 0
eventTraversal() - (*citr)->className() = GraphicsWindowEmbedded

This means the dynamic cast delivers a NULL Pointer but the 
className() Method says GraphicsWindowEmbedded which is 
derived from GraphicsWindow. 
Any idea? Both classes use virtual methods so it should work correctly.
Replacing dynamic_cast by static_cast works great and also my mouse operates 
as expected.

Any help is highly appreciated :-)
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to