Inaccurate mouse movement in OSX?

Using GLFW
Lexi
2012-05-29
2012-11-08
  • Lexi
    Lexi
    2012-05-29

    Hi,
    I've been using the following code to create a FPS style camera movement in my
    program.
    On Windows and Linux, the results are smooth, but when I tried porting to OSX,
    I got extremely jagged movements, with no input for about a second, then a
    burst of (small) movement, then no input again.
    Am I doing something wrong?

        // Mouse events
        if (glfwGetWindowParam(GLFW_ACTIVE) == GL_TRUE) {
            if (lostFocus) {
                lostFocus = false;
                // Reset the mouse for the next call
            } else {
                int x = 0, y = 0;
                glfwGetMousePos(&x, &y);
                data.DeltaViewX = static_cast<float>(x - centerx);
                data.DeltaViewY = static_cast<float>(y - centery);
            }
            glfwSetMousePos(centerx, centery);
        } else {
            // Ignore the mouse if the window's not in focus.
            lostFocus = true;
        }
    
     
  • Camilla Löwy
    Camilla Löwy
    2012-05-29

    Instead of centering the mouse cursor manually, you should likely be using the
    GLFW_MOUSE_CURSOR enable.

     
  • Lexi
    Lexi
    2012-05-30

    Odd, I'm sure I remember that directive only being available for fullscreen
    contexts.
    That solved it though, thanks!