Hi,

I am trying to find mouse positions on a window when I use slave cameras.

Firstly, I tested the positions with camera manuplator.
In this case, if I check the position of left - bottom on windows,
it used to be 0.0, 0.0.

And if the windows size are width = 100 and height = 100, the position of right 
- top used to be 100,100.

However, when I use slave cameras on windows, the position valuse changes.

for examples, 1.01.., 2.0.... I don't know why the position valuse is not 
matched with windows size as I expected.

Is there anyone who knows that?

hear are codes.

// left window + left slave camera
        {
                osg::ref_ptr<osg::GraphicsContext::Traits> traits = new 
osg::GraphicsContext::Traits;
                traits->x = xoffset + 0;
                traits->y = yoffset + 0;
                traits->width = windowsize_width;
                traits->height = windowsize_height;
                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 camera to the viewer, with a shift left of 
the projection matrix
                viewer.addSlave(camera.get(), 
osg::Matrixd::translate(0.0,0.0,0.0), osg::Matrixd());
        }


bool GameEventHandler::handle(const osgGA::GUIEventAdapter& 
ea,osgGA::GUIActionAdapter& aa)
{
        float x = ea.getX();
        float y = ea.getY();

        std::cout<<x<<","<<y<<std::endl;
}
 ... 



Thank you!

Cheers,
HyeongCheol
Code:



Code:



Code:




------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=26217#26217





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to