From: <Dan...@dl...> - 2012-10-04 11:32:25
|
Hi all, I am new to VISTA and try to pipe the scrollwheel movements of a normal mouse via the DataFlowNet on Linux inside my programm I am using VISTA 11 on SUSE Linux 11. I use the following interaction.xml file: <module> <nodespace> </nodespace> <graph> <!-- data source... a mouse --> <node name="mouse" type="DriverSensor"> <param name="sensor" value="0" /> <param name="driver" value="MOUSE" /> </node> <node name="flystick_action" type="Action"> <param name="object" value="FlystickActionObject" /> </node> <node name="project_mouse" type="HistoryProject"> <param name="project">POSITION, LEFT_BUTTON, RIGHT_BUTTON, MIDDLE_BUTTON, X_POS, Y_POS, WHEEL_STATE, WHEEL_DIR</param> </node> <node name="conv_wheel_state" type="TypeConvert[int,double]" /> <node name="conv_wheel_dir" type="TypeConvert[int,double]" /> </graph> <edges> <edge fromnode="mouse" tonode="project_mouse" fromport="history" toport="history" /> <edge fromnode="project_mouse" tonode="conv_wheel_state" fromport="WHEEL_STATE" toport="in" /> <edge fromnode="project_mouse" tonode="conv_wheel_dir" fromport="WHEEL_DIR" toport="in" /> <edge fromnode="conv_wheel_state" tonode="flystick_action" fromport="out" toport="button_state_9" /> <edge fromnode="conv_wheel_dir" tonode="flystick_action" fromport="out" toport="button_state_10" />--> </edges> </module> Some parts of the interaction.ini. I hope I choose the interesting parts: [3DMOUSE] ROLE = 3DMOUSE GRAPH = xml/mouse_ray.xml #RELOADTRIGGER = T [MOUSE] TYPE = MOUSE HISTORY = 10 SENSORS = MOUSE_MAIN DEFAULTWINDOW = TRUE [SPACENAVIGATOR] TYPE = SPACENAVIGATOR HISTORY = 10 [MOUSE_MAIN] RAWID = 0 When the mousewheel is turned I receive zeros on button_state_9 and button_state_10. In the source code of VistaMouseDriver.cpp it looks as port "DSCALAR_3" of "project_mouse" would contain the scrollwheel data. Therefore I also tried to send DSCALAR_3 in my program. But it contains the same data as "WHEEL_DIR" and "WHEEL_STATE". The state of the Left-, Right- and Middle-Button could be piped in my programm without problems. The same problem occurs on Linux with Vista 13. On Windows with Vista 13 everything is fine. Have you any suggestions for me? Is there a workaround to get the information about the scrollwheel movement on Linux? Thank you for your help! Best regards, Daniel Homann |
From: Dominik R. <ra...@vr...> - 2012-10-04 13:06:52
|
Hi What version of glut are you using? Standard glut does not support mouse wheels, but freeglut does, so youll have to built Vista with freeglut. Regards Dominik -- Dipl.-Inform. Dominik Rausch Virtual Reality Group, RWTH Aachen University Lehrstuhl für Informatik 12 (Hochleistungsrechnen) Rechen- und Kommunikationszentrum Seffenter Weg 23, 52074 Aachen Tel. +49 241 80 29732 <mailto:ra...@vr...> ra...@vr... <http://www.vr.rwth-aachen.de> www.vr.rwth-aachen.de From: Dan...@dl... [mailto:Dan...@dl...] Sent: Thursday, October 04, 2012 1:32 PM To: vis...@li... Cc: Rob...@dl...; Rol...@dl... Subject: [vistavrtoolkit-general] Problems with DFN-Node: Could not fetch movements of mouse scrollwheel on linux Hi all, I am new to VISTA and try to pipe the scrollwheel movements of a normal mouse via the DataFlowNet on Linux inside my programm I am using VISTA 11 on SUSE Linux 11. I use the following interaction.xml file: <module> <nodespace> </nodespace> <graph> <!-- data source... a mouse --> <node name="mouse" type="DriverSensor"> <param name="sensor" value="0" /> <param name="driver" value="MOUSE" /> </node> <node name="flystick_action" type="Action"> <param name="object" value="FlystickActionObject" /> </node> <node name="project_mouse" type="HistoryProject"> <param name="project">POSITION, LEFT_BUTTON, RIGHT_BUTTON, MIDDLE_BUTTON, X_POS, Y_POS, WHEEL_STATE, WHEEL_DIR</param> </node> <node name="conv_wheel_state" type="TypeConvert[int,double]" /> <node name="conv_wheel_dir" type="TypeConvert[int,double]" /> </graph> <edges> <edge fromnode="mouse" tonode="project_mouse" fromport="history" toport="history" /> <edge fromnode="project_mouse" tonode="conv_wheel_state" fromport="WHEEL_STATE" toport="in" /> <edge fromnode="project_mouse" tonode="conv_wheel_dir" fromport="WHEEL_DIR" toport="in" /> <edge fromnode="conv_wheel_state" tonode="flystick_action" fromport="out" toport="button_state_9" /> <edge fromnode="conv_wheel_dir" tonode="flystick_action" fromport="out" toport="button_state_10" />--> </edges> </module> Some parts of the interaction.ini. I hope I choose the interesting parts: [3DMOUSE] ROLE = 3DMOUSE GRAPH = xml/mouse_ray.xml #RELOADTRIGGER = T [MOUSE] TYPE = MOUSE HISTORY = 10 SENSORS = MOUSE_MAIN DEFAULTWINDOW = TRUE [SPACENAVIGATOR] TYPE = SPACENAVIGATOR HISTORY = 10 [MOUSE_MAIN] RAWID = 0 When the mousewheel is turned I receive zeros on button_state_9 and button_state_10. In the source code of VistaMouseDriver.cpp it looks as port "DSCALAR_3" of "project_mouse" would contain the scrollwheel data. Therefore I also tried to send DSCALAR_3 in my program. But it contains the same data as "WHEEL_DIR" and "WHEEL_STATE". The state of the Left-, Right- and Middle-Button could be piped in my programm without problems. The same problem occurs on Linux with Vista 13. On Windows with Vista 13 everything is fine. Have you any suggestions for me? Is there a workaround to get the information about the scrollwheel movement on Linux? Thank you for your help! Best regards, Daniel Homann |
From: Ingo A. <iar...@ya...> - 2012-10-04 20:24:21
|
Hi! There are some shortcomings on the current implementation as it is in Vista with regards to the wheel handling. a) if you are using freeglut (which is most often default on Linux), you are fine off, but make sure that you compile the library using the USE_NATIVE_GLUT=0 preprocessor flag. Check your cmake cache file to see the value, os normally the cmake scripts make sure to detect whether you have freeglut or the 'only' the normal glut. b) depending on your version of glut (here is where the 'luck' part starts), it reports mouse wheels as mouse button events. Check if you can find GLUT_WHEEL_<UP|DOWN> flags in your glut(.h). If that is the case, the Vista implementation is plainly not working good, as it does dispatch only the first three buttons and waits for magics to happen to the scroll wheel state. (In a nutshell: current glut implementations show the wheel as additional button). Here is why you see 0 as a value: in case the mouse button callback gets called (which happens if you use glut and not freeglut and you use the wheel), the mouse driver records the current state of the mouse. The right file to look at for your case would be VistaDeviceDrivers/VistaGlutMouseDriver/VistaGlutMouseDriver.cpp, l. 92f). This includes the current state of the variables for the wheel and the wheel state. As they are only changed in the case of freeglut installed, the state variables do not get updated. Are you sure you see "(0,0)" only? And not "(-1,0)"? The code, as it is right now can crash, so its good you pointed that out. It needs to be fixed. It would be very good to know what version of glut you are using and where we can peek at the source. Thanks, hope it helps, Ingo. On 10/04/2012 02:36 PM, Dominik Rausch wrote: > What version of glut are you using? Standard glut does not support mouse > wheels, but freeglut does, so you’ll have to built Vista with freeglut. |
From: Ingo A. <iar...@ya...> - 2012-10-09 21:08:07
Attachments:
GLUTMouseDriver_wheel.patch
|
I attach a patch to read mouse wheel with non-freeglut under linux. Note that in theory, one can read any mapped button on X using glut, including special mouse buttons (I know... the trend is to use just one button ;)... but one could...) However, my proposed solution will not work out of the box with windows glut, and will fail if you, for whatever reasons, have remapped the wheel under X to different button codes. There is a patch for win32 glut available here: http://www.realmtech.net/opengl/glut.php I noticed that my freeglut (2.6.0-1ubuntu3) does not report mousewheel callbacks on linux, so the patch might be considered as standard and have the explicit freeglut dependency removed from the glut mouse driver. Ingo. p.s.: @Daniel: it would be really nice to know which glut version you are using. @Dominik: as X also maps other buttons, the current code could lead to corruption, as we do not check the button index (l.105, #29742) when we write the button value; IMO there should at least be a check/switch-case whatever. On 10/04/2012 10:11 PM, Ingo Assenmacher wrote: > Hi! > > There are some shortcomings on the current implementation as it is in > Vista with regards to the wheel handling. > > a) if you are using freeglut (which is most often default on Linux), you > are fine off, but make sure that you compile the library using the > USE_NATIVE_GLUT=0 preprocessor flag. Check your cmake cache file to see > the value, os normally the cmake scripts make sure to detect whether you > have freeglut or the 'only' the normal glut. > > b) depending on your version of glut (here is where the 'luck' part > starts), it reports mouse wheels as mouse button events. Check if you > can find GLUT_WHEEL_<UP|DOWN> flags in your glut(.h). If that is the > case, the Vista implementation is plainly not working good, as it does > dispatch only the first three buttons and waits for magics to happen to > the scroll wheel state. (In a nutshell: current glut implementations > show the wheel as additional button). > > Here is why you see 0 as a value: > > in case the mouse button callback gets called (which happens if you use > glut and not freeglut and you use the wheel), the mouse driver records > the current state of the mouse. The right file to look at for your case > would be > VistaDeviceDrivers/VistaGlutMouseDriver/VistaGlutMouseDriver.cpp, l. > 92f). This includes the current state of the variables for the wheel and > the wheel state. As they are only changed in the case of freeglut > installed, the state variables do not get updated. Are you sure you see > "(0,0)" only? And not "(-1,0)"? > > > The code, as it is right now can crash, so its good you pointed that > out. It needs to be fixed. It would be very good to know what version of > glut you are using and where we can peek at the source. > |
From: <iar...@ya...> - 2012-10-11 19:55:09
|
Daniel! Answers below. Am 10.10.2012 09:15, schrieb Dan...@dl...: > We have compiled versions of ViSTA on our fileserver. > I used this version and do not want to compile ViSTA on my own. Interesting. Can you tell, out of curiousity, what version of ViSTA do you have precompiled? > Therefore I don't know whether glut or freeglut is used in this version. Right, AFAIK there is no output in the vista binary. You can, however, use "ldd <binary>" to see what version is linked. AND, regardless of how the Vista libraries are compiled, the -> glut <- version would be interesting to know to see what one can do to drag the wheel stuff in. > The people who compiled ViStTA are on a conference until tomorrow. > When they are back again, I will try to follow your advice. > I will tell you about the results. Cool. So far any news? > I am sure that I receive "(0,0)" only and not "(-1,0)" on WHEEL_STATE and WHEEL_DIR. > If I add a Debug-Node to the interaction.xml this is displayed to. You get these valus when the wheel is turned? Or when you hit another button? Ingo. |
From: Ingo A. <iar...@ya...> - 2012-10-18 19:20:47
|
OK, now its clear why you see the particular values and can not access the wheel state. * you use freeglut, and I assume that the cmake script detected that correctly * when using freeglut, the glutWheelFunc() is registered properly * when using glut on X, all mapped buttons (this includes the wheel) are handled by glutMouseFunc(). Wheels are mapped as button 3 and 4 (by default), so they overwrite the values in the intermediate representation of the glut driver (this is a bug in the mouse driver code (for linux) of vista on trunk) * after that, the mouse wheel func is called and this in turn overwrites wheel state values With my patch, both the mouse function and the mouse-wheel func increment the wheel state by 1, giving you only even values. This patch is thus not correct for freeglut on linux (but would work for non-freeglut on linux (that was my assumption)); the windows freeglut event handling does not map the wheel buttons for the normal mouse function, see my older mails. That is why it works out of the box. Ingo. Am 18.10.2012 09:05, schrieb Dan...@dl...: > Dear Ingo, > > Am 10.10.2012 09:15, schrieb Dan...@dl... > <mailto:Dan...@dl...>: > > > We have compiled versions of ViSTA on our fileserver. > > > I used this version and do not want to compile ViSTA on my own. > > Interesting. Can you tell, out of curiousity, what version of ViSTA do > you have precompiled? > > Every version from ViSTA 10 to 13. They can be loaded as modules on the > command line. > >> Therefore I don't know whether glut or freeglut is used in this version. > > Right, AFAIK there is no output in the vista binary. You can, however, > use "ldd <binary>" to see what version is linked. AND, regardless of how > the Vista libraries are compiled, the -> glut <- version would be > interesting to know to see what one can do to drag the wheel stuff in. > > We use freeglut. The libraries name is libglut.so.3.8.0. > > > The people who compiled ViStTA are on a conference until tomorrow. > > > When they are back again, I will try to follow your advice. > > > I will tell you about the results. > > Cool. So far any news? > > Yesterday I applied the patch you send me. It worked. The only minor > issue still not solved is that the WHEEL_STATE on Linux always changes > by two for each unit I turn the mouse wheel. So WHEEL_STATE only returns > even values. On windows instead it changes by one for each unit I turn > the scroll wheel. We solved this issue in our source code. > >> I am sure that I receive "(0,0)" only and not "(-1,0)" on WHEEL_STATE and WHEEL_DIR. > > > If I add a Debug-Node to the interaction.xml this is displayed to. > > You get these valus when the wheel is turned? Or when you hit another > button? > > In both cases. Even if I just move the mouse in the ViSTA window. > > I don't know whether I have written this before: On Windows 7 Vista 11 > supported the scroll wheel out off he box. |