Search code examples
c++windowsopenglraw-inputopenscenegraph

How to use windows raw input in OpenSceneGraph?


I want to use windows raw input to enable two mice input on one computer.

However, I failed to figure out how to get the WM_INPUT message. It seems to get the message, I need to do this:

MainWndProc (HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
        switch (nMsg)
        {
               ...
              case WM_INPUT: 
                {
                        GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, 
                                                        sizeof(RAWINPUTHEADER));
               .............
        }
}

I think the OpenSceneGraph window should be a window's type,but how can I get the WM_INPUT message without using MainWndProc?

It seems I cannot get WM_INPUT message like this:

bool CallbackManager::handle(const GUIEventAdapter& ea, GUIActionAdapter& us)
{
        if(ea.getEventType() == WM_INPUT)

Then should I get the windows handle and how to?


Solution

  • OpenSceneGraph is a cross plattform toolkit. The Windows messages are translated internally in OpenSceneGraph and turned into OSG specific types. What you get in the CallbackManager is completely detached from the Windows messages.

    Short of diving into the OpenSceneGraph code and adding the multiple pointer device support in OSG's core, there's little you can do about it.