Developement Java3D with SpaceTraveler

Questions and answers about 3Dconnexion devices on Windows.

Moderator: Moderators

lololem
Posts: 37
Joined: Sat Mar 24, 2007 10:25 am

Developement Java3D with SpaceTraveler

Post by lololem »

Hi, i am a french student from Polytech'Tours, a enginerring school.

We have a problem, we develop an interface with Java 3D and we need to use a SpaceTraveler.

I do a research on the internet, and i see that a chinese student have a same problem of me => viewtopic.php?p=634

I understand that it's necessary to use JNI for transcript you're SDK to Java.
I download your exemple "Jnisiapp" but when i launch the applet "HelloUniverse.html", i have that http://www.dotnetclub.info/images/Appli.JPG.

i don't understand what's happen.

If i want create an application with Java 3D, what will i do?

Thanks

Best Regards.
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Hello lololem,

I don't see any errors in the screen shot you sent, just an empy window.

Make sure the SpaceTraveler works with the demos before trying Java.

You can also try to use our new SDK. It is COM based. Unfortunately we don't have any Java examples for it.

Perhaps someone else in the community can help out.

Jim
3Dx Software Development
lololem
Posts: 37
Joined: Sat Mar 24, 2007 10:25 am

Post by lololem »

i don't understand.

I read your topic :
Hi Dan,

Do you mean console as in Windows console (no GUI, no Windows main loop), or console as in xbox 360/ps3/Wii?

If the former, there is some sample Java code that you may be able to use on:

ftp://ftp-us.3dconnexion.com/jni
login: jni
password: dev1221

JNIsiapp.zip contains a JNI version of the 3Dconnexion siapp static library that is used by the 3DxWare Windows SDK. It implements most of the functions from the Windows C++ SDK. I'll admit I've only tested the ones in the sample code (JNIsiappThread.java). Obviously the siapp static library became a DLL for Java (JNIsiapp.dll). There is a HelloUniverse program in the src directory that exercises the interface. The reading of the device is in JNIsiappThread.java. The assumption is that you will have a thread dedicated to handling the device. Your code will wait for input in a call to JNIsiapp.SiWaitForEvent, then get the data from JNIsiapp.SiGetEvent. Make sure to call SiClose and SiTerminate or kill your thread or your thread won't return from the wait.

In addition to this code, I think you also need to install the 3DxWare SDK and the driver from our website. All of these pieces are free from any licensing obligations.

HelloSpacemouse3DxWare.zip is a version of the Java3D HelloSpacemouse program from the net that uses the 3DxWare driver instead of going to the serial port. The changes are limited to the pollAndProcessInput method of the SpacemouseDevice class. If you use this method, you will be able to support any 3Dx device that the driver supports, but, of course, you are limited to Windows.

If you use this and make changes, or create examples, that might help others, please post your changes.

Have fun!

Jim
3Dx Software Development
and you propose a little application who call an API Java 3D.

In my screenshot, i launch your applet HelloUniverse and i tkink there is a cube are modelled but there is nothing.

I want to know what function of SDK, i do transcript in Java for use spaceTraveler in Java3D?

Have u got an other exemple of JniPrograms who runs?

Best Regards
lololem
Posts: 37
Joined: Sat Mar 24, 2007 10:25 am

Post by lololem »

In fact, i understand you're application HelloUniverse make a cube in java3D who can be drive by the mouse SpaceTraveler.

I try to make you're folder JniApplication and i have just that => http://www.dotnetclub.info/images/javaApplication.JPG, an applet empty.

May be i understand nothing... and if it's that your application do what?

;) Thanks

Best regards
Last edited by lololem on Tue Mar 27, 2007 1:32 pm, edited 1 time in total.
lololem
Posts: 37
Joined: Sat Mar 24, 2007 10:25 am

Post by lololem »

Any body know how use Space Traveler with Java 3D ????
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Hi lololem,

Hopefully someone in the community will be able to help. It will be quite a while before I will be able to load up a Java development environment and look at this.

One thing I noticed is that you are using firefox. The JNI solution was developed with IE. I don't know if that will make a difference. But it is worth giving it a try under IE.

You have all the src code for this. If you debug down into it, how far is it getting? Old fashioned debugging...

Jim
3Dx Software Development
lololem
Posts: 37
Joined: Sat Mar 24, 2007 10:25 am

Post by lololem »

Hi jwick

Thanks for your answer.

I test with IE and i have no result, always the white box with a red cross.
You are right, i go to understand and debugging the program,
in any way i have no choice, we have got to working the mouse with Java3D.

if you have least additional information, contact me.

Best Regards.
lololem
Posts: 37
Joined: Sat Mar 24, 2007 10:25 am

Post by lololem »

Hi,

I didn't know but i french student of my school works in the same problem.
I realize and debug the JNI program, now the space Traveler runs with Java3D.

Thanks for u're answer.

Bye.
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Hi lololem,

That's fantastic.

Would you be willing to share the changes to help others use the 3Dx devices with Java3D?

Jim
3Dx Software Development
chamorrus
Posts: 10
Joined: Wed Oct 10, 2007 5:31 am

Java3D

Post by chamorrus »

Hi all!
Im new in this forum. I have been reading any clue about j3d and 3dConnexion mouse... But I haven't found anything.
The problem I have is that the example I have (HelloSpacemouse.java) works very good (a little bit slow I think) but when I try to add another kind of functionality (for example the MouseTranslate ability) I cant handle the color cube with the conventional mouse, I dont know I anyboudy have tried this.
What I want to do is a movement similar to Google Earth where you can use either the 3dconnexion mouse or the conconventional one.

Thanks a lot for reading the post!
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

You might need to handle the mouse and the SpaceTraveler in two separate threads.

Take a look at this other thread for a different approach:
Example in Java
chamorrus
Posts: 10
Joined: Wed Oct 10, 2007 5:31 am

Post by chamorrus »

Thanks for the reply jwick. I'm going to have a look to this post.
chamorrus
Posts: 10
Joined: Wed Oct 10, 2007 5:31 am

Post by chamorrus »

I have been having a look at the example you sent jwick and it seems to be very helpful but it doesn't give any clue about my problem.

I think I have not explained it right. I think that the best way to solve my jigsaw is trying to capture SpaceTraveler events and transform them into mouse events so I can handle them with my own classes.
I mean that if I have a Y rotation performed by the SpaceTraveler I would like to transform it into a MouseEvent.MOUSE_DRAG (for example).

I dont know if I have explained it well... If so, do you have any other link where I can get information on how to do that?

Thanks again!
jwick
Moderator
Moderator
Posts: 3341
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

Hi chamorrus,

I don't understand what you are trying to do. If you apply the Y rotation to a mouse drag event, what are you going to do with the other 5 axes?

Do you truly have only a 2 degree of freedom problem that you are trying to apply the SpaceTraveler to?

I thought you were trying to move a 3D item with a mouse and a SpaceTraveler at the same time. Those would involve different mathematics. They should work simultaneously without any problem.

Jim
3Dx Software Development
chamorrus
Posts: 10
Joined: Wed Oct 10, 2007 5:31 am

Post by chamorrus »

Hi Jim!
I have to say that the biggest problem is my poor english and the problems I have to explain what I want to do so... I'm gonna try it.
I have a 3D world. In this world I have captured MouseEvents so if I drag the mouse, my world will move (I mean panning), if I make a double click on any object, I will get information about that object (Mouse picking report). As well if I receive a MOUSE_WHEEL event, my world will perform a zoom in or zoom out.
I also have captured the keyboard events to simulate the rest of the navigation. I mean that if I push the left key or the right key, my world will rotate on one of the axis (for example Y axis) and if I push the up key or the down key, my world will rotate on the X axis.
Like this I have my six axis implemented with the keyborad and a conventional mouse.

What I want to do is to handle the navigation with the SpaceNavigator and I want the mouse drag to help the SpaceNavigator. I mean keep the functionality of the SpaceNavigator that lets objects rotate in one axis and use the mouse drag to travel around 'my world'.

In order to give you a visual example, is the same movement that Google Earth provides if you handle it with your SpaceNavigator plus your Mouse.

I don't know if I have explained it right. But I don't know how to do that...

I have tried solutions like catching all the events produced by the mouse events and if that events are the events I want, do the corresponding modifications to the TransformGroups. But my problem here is that I need to add the input device to get its events. I need to write the code line u.getViewer().getPhysicalEnvironment().addInputDevice( SmDev ); Ok, that's right, BUT the mouse doesn't works unless a SpaceNavigator event is received and that's what I don't want to happen...

Tell me if you understand my problem or if I have to go to another Thread of the forum because it is really important.

Thank you for your attention.
Post Reply