Skip to content

Mouse wheel direction wrong for glut and glfw #3171

@ghost

Description

The mouse wheel direction is upside down for
glfw3 with every browser I tested
and
glut with chromium.
sdl2 appears to be correct.

Test results for scrolling down and up once with code:
https://gist.github.com/00v1/0ddc40dec5d395456193#file-mousewheel-txt

Xubuntu Desktop

    glfw3 down -1.000000
    glfw3 up 1.00000

    glut down button = 4, state = 0
    glut down button = 4, state = 1
    glut up button = 3, state = 0
    glut up button = 3, state = 1

    sdl2 down -1
    sdl2 up 1

Linux Firefox

    glfw3 up 3.000000 // wrong direction
    glfw3 down -3.000000 // wrong direction

    glut down button = 4, state = 0
    // missing state = 1
    glut up button = 3, state = 0
    // missing state = 1

    sdl2 down -3
    sdl2 up 3

Linux Chromium

    glfw3 up 53.000000 // wrong direction
    glfw3 down -53.000000 // wrong direction

    glut up button = 3, state = 0 // wrong direction
    // missing state = 1
    glut down button = 4, state = 0 // wrong direction
    // missing state = 1

    sdl2 down -53
    sdl2 up 53

Windows Firefox // Same as on Linux

    glfw3 up 3.000000
    glfw3 down -3.000000

    glut down button = 4, state = 0
    glut up button = 3, state = 0

    sdl2 down -3
    sdl2 up 3

Windows Chrome // Same as on Linux, different scaling

    glfw3 up 100.000000
    glfw3 down -100.000000

    glut up button = 3, state = 0
    glut down button = 4, state = 0

    sdl2 down -100
    sdl2 up 100

Windows Opera // Same as Chrome

    glfw3 up 100.000000
    glfw3 down -100.000000

    glut up button = 3, state = 0
    glut down button = 4, state = 0

    sdl2 down -100
    sdl2 up 100

Compile with

emcc glfw3.cpp -o glfw3.html -s USE_GLFW=3
emcc  glut.cpp -o  glut.html
emcc  sdl2.cpp -o  sdl2.html -s USE_SDL=2

Relevant function:
https://github.com/kripken/emscripten/search?utf8=%E2%9C%93&q=getMouseWheelDelta

To avoid confusion:
"Down" is when the upper side of the mouse wheel travels towards you, or when you scroll "down" a website.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions