Jeremy Moles <[EMAIL PROTECTED]> writes: > > Again, I never get the normalized values in osgWidget (and haven't since > I began writing it). This has to have something to do with the kind of > camera the event appears within, as looking through the code I see that > the event{X,Y} values are calculated two different ways depending on > whether a function getFocusedCamera() returns true or not...
You're right, that there are two ways that the event (X,Y) is calculated, and in my case, the first branch is used [ if (getCameraWithFocus()) ]. If I comment out this branch, then the (X,Y) locations can be used correctly (after transforming them back). One of these two branches will be used, since pointerEvent is set to true earlier. I don't think I'm doing anything special with my camera setup (looks pretty plain vanilla to me),so I'll have to look into it a bit more. Thanks for the tip. As a note related to osgWidget, you might want to also keep this issue in mind - the mouse X,Y can be transformed in a different way, depending on a setting related to the camera. > > How is your scene laid out? I've never used CEGUI with OSG, so I'm not > sure how people in the past have done it. > I'm just using fairly standard settings. To get CEGUI to render last, I've done a stateset->setRenderBinDetails( 11, "RenderBin"); for the group containing CEGUI. As well, I'm using singlethreading for drawing. The rest of the code I'm trying looks pretty standard... mViewer = new osgViewer::Viewer(); osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; osg::ref_ptr<osg::Referenced> windata = new osgViewer::GraphicsWindowWin32::WindowData((HWND)this->Handle.ToInt32()); // Setup traits traits->x = 0; traits->y = 0; traits->width = this->Width; traits->height = this->Height; traits->windowDecoration = false; traits->doubleBuffer = true; traits->sharedContext = 0; traits->setInheritedWindowPixelFormat = true; traits->inheritedWindowData = windata; // graphics context osg::GraphicsContext* gc = osg::GraphicsContext::createGraphicsContext(traits.get()); // new camera initialization osg::ref_ptr<osg::Camera> camera = new osg::Camera(); // Assign Graphics Context to the Camera camera->setGraphicsContext(gc); // camera viewport camera->setViewport(new osg::Viewport(traits->x, traits->y, traits->width, traits->height)); mViewer->addSlave(camera.get()); mViewer->setCameraManipulator(new osgGA::TrackballManipulator()); _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org