In fact I guess this is still linking to the amulti threading issue : I'm
building by viewer in a Thread n°1 (-> one call to createGraphicsContext()),
then I call run() in a second thread (--> call realize())...

what is the good solution in this situation ? should I prepare everything in
thread 1, call realize() here and only then call run() or frame() in thread
2 ? or should I do everything in thread 2 only ?

I'm still not understanding what's happening :-)...

Manu.


2007/6/5, Emmanuel Roche <[EMAIL PROTECTED]>:

Hello there !!


I'm playing a bit with this new viewer and noticed a strange behavior :

under windows, when I use a default fullscreen viewer I receive all key
events normally in a GUIEventHandler I added to my Viewer, but, if I try to
build a windowed viewer, adding the following code:

    {
        osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
osg::GraphicsContext::Traits;
        traits->x = 50;
        traits->y = 50;
        traits->width = 640;
        traits->height = 480;
        traits->windowDecoration = true;
        traits->doubleBuffer = true;
        traits->sharedContext = 0;

        osg::ref_ptr<osg::GraphicsContext> gc =
osg::GraphicsContext::createGraphicsContext( traits.get());


        osg::ref_ptr<osg::Camera> camera = new osg::Camera;
        camera->setGraphicsContext(gc.get());
        camera->setViewport(new osg::Viewport(0,0, traits->width,
traits->height));
        GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;
        camera->setDrawBuffer(buffer);
        camera->setReadBuffer(buffer);

        // add this slave camra to the viewer, with a shift left of the
projection matrix
        //viewer.setCamera( camera.get());

        viewer.addSlave(camera.get(), osg::Matrixd(), osg::Matrixd());
        viewer.setCameraWithFocus(camera.get());
    }


(taken mainly from osgwindows sample...)
then my GUIEventHandler is not receiving the Key_Up, Down , Left and Right
events (at least !) any more... :-( (but is still receiving normal ascii
keys like 'a' or 'q' for example)... any idea what I'm missing ?

Manu.



_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to