[osg-users] How do I continuously read the mouse position as the mouse is moving, without a click event in osg

Kris Bartowski kpoloczek at vp.pl
Tue Feb 26 22:47:12 PST 2019


Trajce Nikolov NICK wrote:
> Hi Kris,
> 
> 
> are you on windows? If so, you can force the Windows Manager to pass all events to the osgView. Here is some snippet:
> 
> 
> osgViewer::CompositeViewer::Windows wins;    viewer->getWindows(wins);    
> while (!viewer->done())    {    
> #if defined(_WIN32)    MSG msg;    if (::PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))    {    ::GetMessage(&msg, NULL, 0, 0);    
> if (wins.size())    {    osgViewer::GraphicsHandleWin32 *hdl = dynamic_cast<osgViewer::GraphicsHandleWin32*>(wins.at(0));    if(hdl)    {    WNDPROC fWndProc = (WNDPROC)::GetWindowLongPtr(hdl->getHWND(), GWLP_WNDPROC);    if (fWndProc && hdl->getHWND())    {    ::CallWindowProc(fWndProc,hdl->getHWND(),msg.message, msg.wParam, msg.lParam);    }    }    }    }   #endif
> 
> 
> On Wed, Feb 13, 2019 at 8:31 AM Kris Bartowski < ()> wrote:
> 
> 
> > 
> > gwaldron wrote:
> > 
> > > Kris,You want to install an osgGA::GUIEventHandler, override the handle method, and listen for the MOVE or DRAG events. DRAG fires when moving the mouse with a button down.
> > > Glenn Waldron / osgEarth
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > On Fri, Feb 8, 2019 at 6:03 AM Kris Bartowski < ()> wrote:
> > > 
> > > 
> > > 
> > > > Hi,
> > > > 
> > > > I want to read the mouse location at any time, but unfortunately when i try to read it for example when event type is FRAME, it always gives me the last clicked mouse coordinates.
> > > > 
> > > > Thank you!
> > > > 
> > > > Cheers,
> > > > Kris
> > > > 
> > > > ------------------
> > > > Read this topic online here:
> > > > http://forum.openscenegraph.org/viewtopic.php?p=75598#75598 (http://forum.openscenegraph.org/viewtopic.php?p=75598#75598) (http://forum.openscenegraph.org/viewtopic.php?p=75598#75598 (http://forum.openscenegraph.org/viewtopic.php?p=75598#75598))
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > _______________________________________________
> > > > osg-users mailing list
> > > >   ()
> > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org))
> > > > 
> > > > 
> > > 
> > > 
> > >   ------------------
> > > Post generated by Mail2Forum
> > > 
> > 
> > 
> > That's what i do, but for some reason ea->getEventType() is never equal to osgGA::GUIEventAdapter::MOVE, i am notified only when the DRAG and PUSH events fire. 
> > 
> > I use OpenSceneGraph Library 3.2.3
> > 
> > ~Kris
> > 
> > ------------------
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=75624#75624 (http://forum.openscenegraph.org/viewtopic.php?p=75624#75624)
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > osg-users mailing list
> >  ()
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
> > 
> 
> 
> -- 
> trajce nikolov nick
> 
>  ------------------
> Post generated by Mail2Forum


Hi

I'm on ubuntu 18.04 and still  dealing with this problem

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







More information about the osg-users mailing list