Developement Java3D with SpaceTraveler
Moderator: Moderators
It seems like your thread is blocking waiting for data from the SpaceTraveler. That's why your mouse doesn't do anything until you move the ST.
There may be other ways to do this, but I'd start a separate thread to listen to the ST and use the main thread to listen to the mouse and the other system events. When something happens on the ST thread, you can update TransformGroups, and wake up the main thread so it redraws.
You could also ship the raw ST data to the main thread to have it do the modifications to TransformGroups.
Does this help?
Jim
3Dx Software Development
There may be other ways to do this, but I'd start a separate thread to listen to the ST and use the main thread to listen to the mouse and the other system events. When something happens on the ST thread, you can update TransformGroups, and wake up the main thread so it redraws.
You could also ship the raw ST data to the main thread to have it do the modifications to TransformGroups.
Does this help?
Jim
3Dx Software Development
Hi Jim! Thanks again for your reply!
I think that you're right, it seems to be like the thread is blocked... But I have to apologize just because I don't know how to start another thread to listen to the ST events...
I want to do that but I don't know how... Can you help me?! (I don't want code, I want ideas or clues)
Thanks in advance!
I think that you're right, it seems to be like the thread is blocked... But I have to apologize just because I don't know how to start another thread to listen to the ST events...
I want to do that but I don't know how... Can you help me?! (I don't want code, I want ideas or clues)
Thanks in advance!
Hello again Jim!
After the misunderstanding of the last week (sorry again for that), I have been testing the possibility of programming the SpaceNavigator and Mouse Behaviors in separate threads.
I put the SpaceNavigator behavior in one separate thread and it won't work. I tried to program the mouse behavior in a separate thread with the same luck.
My last chance (trying to test both behaviors, SpaceNavigator and mouse, each in a separate thread) neither work.
Do you have more ideas?! Now I'm completely lost...
After the misunderstanding of the last week (sorry again for that), I have been testing the possibility of programming the SpaceNavigator and Mouse Behaviors in separate threads.
I put the SpaceNavigator behavior in one separate thread and it won't work. I tried to program the mouse behavior in a separate thread with the same luck.
My last chance (trying to test both behaviors, SpaceNavigator and mouse, each in a separate thread) neither work.
Do you have more ideas?! Now I'm completely lost...
Hi chamorrus!
I'm experimenting exactly the same problem.
I also tried the solution you mentioned with the same luck you had.
The Mouse Behavior (whether Zoom or Translation) really works, but when I carry out the Transform3D update, the Shape3D I'm trying to Translate appears to flicker. It's because of the translation is really done, but inmediatly the Shape3D returns to it's original position.
It seems to be that there is some kind of daemon which 'recalculates' the position of the Shape and only it's modified if a SpaceTraveler event is captured, so modifications done with the mouse will not work.
Any idea on how to do that?
I'm experimenting exactly the same problem.
I also tried the solution you mentioned with the same luck you had.
The Mouse Behavior (whether Zoom or Translation) really works, but when I carry out the Transform3D update, the Shape3D I'm trying to Translate appears to flicker. It's because of the translation is really done, but inmediatly the Shape3D returns to it's original position.
It seems to be that there is some kind of daemon which 'recalculates' the position of the Shape and only it's modified if a SpaceTraveler event is captured, so modifications done with the mouse will not work.
Any idea on how to do that?
Hi chamorrus and samgp,
I'm an old fashioned debugger. I print out what is going on. I find this particularly useful in processes in which a lot of simultaneous threads are running. I'd print out the values you get from the device, the changes to your matrices (Transform3D) and put a print in processStimulus (for the mouse and the 3Dx device). You might have to put print statements in the JNIsiapp library to see what else is going on.
Finally, I'd turn logging on in the driver which would tell me which window is connecting to the device, and use Spy++ to see which window that is.
The driver normally sends data to the window with focus. If you have a process that doesn't have a window, it won't work. If your window doesn't have focus you may have to use the SiGrabDevice call to do a hard grab on the data stream from the device. This will ensure that the data goes to your window even if another window is in the foreground.
Jim
3Dx Software Development
I'm an old fashioned debugger. I print out what is going on. I find this particularly useful in processes in which a lot of simultaneous threads are running. I'd print out the values you get from the device, the changes to your matrices (Transform3D) and put a print in processStimulus (for the mouse and the 3Dx device). You might have to put print statements in the JNIsiapp library to see what else is going on.
Finally, I'd turn logging on in the driver which would tell me which window is connecting to the device, and use Spy++ to see which window that is.
The driver normally sends data to the window with focus. If you have a process that doesn't have a window, it won't work. If your window doesn't have focus you may have to use the SiGrabDevice call to do a hard grab on the data stream from the device. This will ensure that the data goes to your window even if another window is in the foreground.
Jim
3Dx Software Development
Hi guys!
I think I found a solution... Not the best one but it works. What I do is passing a reference of the MouseBehavior class I want to manipulate to the SpacemouseDevice class so when I capture a mouse event I do the necessary transformations to the MouseBehavior class.
The way I use to stop the SpaceNavigator thread to capture all the events is putting the line
siapp.SiWaitForEvent();
into a comment, so the Thread will not block waiting for events.
The problem I have now is that I get the next error:
"java.lang.UnsatisfiedLinkError: SiInitialize (...)" but I've seen there's another thread about this issue, so I'm going to have a look.
Hope it helps and thank you for your reply Jim, but I don't have enough time right now to follow the steps you posted.
If I found any other way to solve the problem I'll post it here. Thanks for all the posts!
I think I found a solution... Not the best one but it works. What I do is passing a reference of the MouseBehavior class I want to manipulate to the SpacemouseDevice class so when I capture a mouse event I do the necessary transformations to the MouseBehavior class.
The way I use to stop the SpaceNavigator thread to capture all the events is putting the line
siapp.SiWaitForEvent();
into a comment, so the Thread will not block waiting for events.
The problem I have now is that I get the next error:
"java.lang.UnsatisfiedLinkError: SiInitialize (...)" but I've seen there's another thread about this issue, so I'm going to have a look.
Hope it helps and thank you for your reply Jim, but I don't have enough time right now to follow the steps you posted.
If I found any other way to solve the problem I'll post it here. Thanks for all the posts!
Hi chamorrus,
I thought about the solution you post before, but I don't rely on it... It works, but I think it is not the best way to solve the problem.
About the problem you are having with the java.lang.UnsatisfiedLinkError, I have the same problem, just when the application executes the line siapp.SiInitialize(); I have been reading about the error we have with no luck. Have you found a solution?!
Can you help us with that Jim?!
- I have the file JNIsiapp.dll in the folder system32.
- I have checked that System.getProperty("java.library.path") contains that folder.
- I also checked that the name of the .dll is right (I mean case sensitive).
- ...
Now I'm 100% lost. Any comment will be very helpful!
I thought about the solution you post before, but I don't rely on it... It works, but I think it is not the best way to solve the problem.
About the problem you are having with the java.lang.UnsatisfiedLinkError, I have the same problem, just when the application executes the line siapp.SiInitialize(); I have been reading about the error we have with no luck. Have you found a solution?!
Can you help us with that Jim?!
- I have the file JNIsiapp.dll in the folder system32.
- I have checked that System.getProperty("java.library.path") contains that folder.
- I also checked that the name of the .dll is right (I mean case sensitive).
- ...
Now I'm 100% lost. Any comment will be very helpful!