GLVis / glvis

Lightweight OpenGL tool for accurate and flexible finite element visualization
http://glvis.org
BSD 3-Clause "New" or "Revised" License
249 stars 51 forks source link

Space mouse support #263

Open jtristano opened 1 year ago

jtristano commented 1 year ago

I know that onshape supports space mouse. Can glvis also support space mouse, especially in live mode within the browser?

v-dobrev commented 1 year ago

GLVis uses SDL2, so the question of adding support for space mouse is if SDL2 detects the device and then what type of SDL_* events it generates, so we can process them in various places, e.g. here: https://github.com/GLVis/glvis/blob/c2e621cb042cc0950fc4bc1472a1410bfcbe36bf/lib/sdl.cpp#L362 here: https://github.com/GLVis/glvis/blob/c2e621cb042cc0950fc4bc1472a1410bfcbe36bf/lib/sdl_main.cpp#L188 and probably other places.

One can probably add potential event candidates to the big switch in the method SdlMainThread::DispatchSDLEvents() with a print statement to see what events are generated by the device. The potential candidates are most likely the following SDL events: https://github.com/libsdl-org/SDL/blob/9237f8edc16c88028a6de5514196fb798c4a0f5c/include/SDL_events.h#L113-L133