Integrating Space Navigator with Delta3D

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
saravanan
Posts: 2
Joined: Mon Aug 17, 2015 4:16 am

Integrating Space Navigator with Delta3D

Post by saravanan »

We have integrated Delta3D with the Space Navigator using the SDK provided by 3D Connexion. We are facing some issues with handling events from Space Naviagtor and screen refresh (redraw).
The code to handle event is given below

Code: Select all


void DispatchLoop()
{       
        MSG msg;        
        int handledEvent;
        SiGetEventData EData;
        SiSpwEvent         Event;
        BOOL               getMsg;
        
        // Process messages
        if ((getMsg = GetMessage(&msg, NULL, 0, 0)) != 0)
        //if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
        {                       
                SpwReturnValue ret;
                handledEvent = FALSE;

                if (devHdl != SI_NO_HANDLE)
                {
                        SiGetEventWinInit(&EData, msg.message, msg.wParam, msg.lParam);
                        
                        if ((ret = SiGetEvent(devHdl, 0, &EData, &Event)) == SI_IS_EVENT)
                        {                       
                                if (Event.type == SI_MOTION_EVENT)
                            {
                                        // Handle motion event
                                        SbMotionEvent(&Event);

                            }   

                                handledEvent = TRUE;
                        } 
                }
        
                // If it wasn't a 3D mouse event, handle it through the normal channels.
            if (handledEvent == FALSE)
                {
                        TranslateMessage (&msg);
                        DispatchMessage (&msg);
                }
        }
}

void Delta3DApp::PreFrame(const double deltaSimTime)
{
        // Dispatch message loop
        DispatchLoop();

        // Perform 3d model update
        //.......
}

When using GetMessage() function i am able to receive Space Navigator events, but the scene will be refreshed only if there is any key/mouse/SpaceNav events. If i use the PeekMessage() fuction, i am not able to receive the Space Navigator events properly, but the screen is refreshing properly. I have tried placing the event receiving function (Dispatch Loop)in an another thread, but that is not working. Kindly provide us a solution.

Thanks.
UtaSH
Moderator
Moderator
Posts: 3754
Joined: Mon Nov 27, 2006 10:34 am
Location: Munich, Germany
Contact:

Re: Integrating Space Navigator with Delta3D

Post by UtaSH »

Moving this to the Developer Forum.
jwick
Moderator
Moderator
Posts: 3331
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Integrating Space Navigator with Delta3D

Post by jwick »

Isn't GetMessage blocking? Some event is needed to cause it to return.
Post Reply