Use of OrbitBehavior with JCanvas3d

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Use of OrbitBehavior with JCanvas3d

OliverR
Hallo,

I have just migrated from 10 years old java3d technology into the current version 1.7. Changing of the imports needs a lot of time but works fine. The only trubble I have is the usage of OrbitBehavoir. In my old code I use

http://www.interactivemesh.org/testspace/orbitbehavior.html

I have tried to migrate to

https://jogamp.org/deployment/java3d/1.7.0-final/j3dutils/javadoc/

The code builds but mouse navigation does not work any more.

I have looked for any example how to use OrbitBehavoir in combination with JCanvas3d but I havnt found any.

The only example I have found is

https://github.com/philjord/java3d-examples/tree/master/src/main/java/org/jdesktop/j3d/examples/objload

but it is for canvas3d only and does not includes detailed explainations to implement more complex stuff.

Any help appriciated.

best regards
Oliver
Reply | Threaded
Open this post in threaded view
|

Re: Use of OrbitBehavior with JCanvas3d

gouessej
Administrator
Hello

Are you sure that interactivemesh's source code hasn't diverged from JogAmp's source code?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Use of OrbitBehavior with JCanvas3d

philjord
Oliver,
Unfortunately the original code for OrbitBehavior and all platform behaviors is hard coded to require Canvas3D, probably so it can automatically pick up the canvas to listen to when attached to a platform.

The good news is because Java3D is open source you can just edit it to require and use JCanvas3D (because it only really needs to listen to a Component).

I've attached 4 files from the example project
https://github.com/philjord/java3d-examples/tree/master/src/main/java/org/jdesktop/j3d/examples/jcanvas3d


JCanvas3DExample.java is un-altered
JInternalWorld.java has the normal MouseRotate disabled and a OrbitBehavior added instead
OrbitBehaviorJCanvas3D.java simply swaps Canvas3D to JCanvas3D
ViewPlatformAWTBehaviorJCanvas3D.java swaps Canvas3D to JCanvas3D and also disables taking Canvases from the view platform (because JCanvas3D uses off screen Canvas3D which can never receive AWT events)


hopefully from this you can rebuild your project to working state.

Note these are not GPL with classpath licenses they are simply BSD

Phil
Reply | Threaded
Open this post in threaded view
|

Re: Use of OrbitBehavior with JCanvas3d

OliverR
Hi Phil,

very very thanks for your quick help. Now it looks very easy to me to rebuild my old project to a working state again.

Where could we collect such missing java3d features for the community? I have also some useful objects like arrows and several codes, which maybe are useful for scientific computung. Do you think it makes sense to set up a small lib/project with utils/extentions for java3d? Maybe it is an overkill.

Oliver
Reply | Threaded
Open this post in threaded view
|

Re: Use of OrbitBehavior with JCanvas3d

OliverR
In reply to this post by gouessej
Hello Julien,

Yes, I think I was misleaded from some comments, that makes me expected that the current version of java3d should include newer version of the interactiveMesh original codes of OrbitBehavoir with JCanvas3d.

Thanks for your reply
Oliver