incorrect mouse Y coordinate

Using GLFW
2014-07-26
2014-07-26
  • Jaymin Kessler
    Jaymin Kessler
    2014-07-26

    I'm noticing something weird where as the mouse pointer moves down the screen, the Y value returned by glfwGetCursorPos( ) drifts more and more. For a 1920x1080 window, we get 0 at the top of the screen and 1018 at the bottom. This doesn't happen in the X direction and it is considerably better for windows with smaller heights. It almost feels like GLFW doesn't quite know the window height and thinks its larger than it really is

    Curious of anyone has seen this before
    Happens in GLFW 3.0.3 and 3.0.4 on Mac OS X.

     
  • Jaymin Kessler
    Jaymin Kessler
    2014-07-26

    and just in case there is some lunacy in how I am setting things up

    bool fullscreen = screen_size.x == 0 && screen_size.y == 0; 
    m_screen_size = screen_size;
    glfwSetErrorCallback( GlfwErrorHandler );
    
    if( !glfwInit() )
    {
        ASSERT_MSG( 0, "glfwInit failed" );
        return -1;
    }
    
    if( fullscreen )
    {
        int count = 0;
        //GLFWmonitor **monitors = glfwGetMonitors( &count );
        GLFWmonitor *primary_monitor = glfwGetPrimaryMonitor( );
        ASSERT( primary_monitor );
    
        const GLFWvidmode *video_mode = glfwGetVideoMode( primary_monitor );
        m_screen_size = v2i_pack( video_mode->width, video_mode->height );
    
        const char *monitor_name = glfwGetMonitorName( primary_monitor );
        ASSERT( monitor_name );
    }
    
    glfwWindowHint( GLFW_SAMPLES, 4 );
    
    m_window = glfwCreateWindow
    (
        m_screen_size.x, 
        m_screen_size.y, 
        window_name, 
        NULL, 
        NULL
    );
    if( !m_window )
    {
        glfwTerminate( );
        ASSERT_MSG( 0, "glfwTerminate failed" );
        return -1;
    }
    
    glfwMakeContextCurrent( m_window );