Ok, thanks. There are some differences to my VirtualUniverse. First, I
haven't defined a ViewingPlatform at all, neither a Viewer object. But I
have got two ViewPlatforms. Actually I am a bit confused.
If I have 2 ViewPlatforms do there have to be 2 ViewingPlatforms, too?
And 2 Viewer objects?
I have got 2 windows. One for the left and one for the right eye.
Currently there is a ViewPlatform for each eye. And they are both in the
same universe, of course. All that is set in each window, is
- tgView.addChild(viewPlatform); //where tgView is connected to the
ViewBranch of the Scenegraph.
- view.attachViewPlatform(viewPlatform);
- view.setLeftProjection(camera);//where camera is a Transform3D with a
set frustum.
- other things like PhysicalBody(), PhysicalEnvironment(),
GraphicsConfiguration I considered not imporant for this problem.
How do I add the other stuff from the SimpleUniverse?
yours,
Thomas
Alexander Gran schrieb:
Thomas Partsch schrieb:
> Ok, thanks. There are some differences to my VirtualUniverse. First, I
> haven't defined a ViewingPlatform at all, neither a Viewer object. But I
> have got two ViewPlatforms. Actually I am a bit confused.
>
> If I have 2 ViewPlatforms do there have to be 2 ViewingPlatforms, too?
> And 2 Viewer objects?
Sorry, I have no Idea whatsoever ;)
regards
Alex

Signature
Some operating systems are called `user friendly',
Linux however is `expert friendly'.
Encrypted Mails welcome. Send spam to toZodiac@gmx.net, please.
PGP-Key at http://www.grans.eu/misc/pgpkey.asc | Key-ID: 0x6D7DD291
> Ok, thanks. There are some differences to my VirtualUniverse. First, I
> haven't defined a ViewingPlatform at all, neither a Viewer object. But
> I have got two ViewPlatforms. Actually I am a bit confused.
>
> If I have 2 ViewPlatforms do there have to be 2 ViewingPlatforms, too?
> And 2 Viewer objects?
Your confusion is understandable given the similar names.
The ViewingPlatform is a Java 3D utility class
(com.sun.j3d.utils.universe.ViewingPlatform) that extends BranchGroup
and contains a ViewPlatform Java 3D core class
(javax.media.j3d.ViewPlatform). It's simply a convenient base for
building a bunch of other utility classes and behaviors (such as
SimpleUniverse), and if you're not going to use any of the utility
classes you don't need it.
Viewer is also a universe utility and simply wraps a View along with
some other stuff like a Canvas3D list and an Avatar. If you use Views
directly you don't need it.
> I have got 2 windows. One for the left and one for the right
> eye. Currently there is a ViewPlatform for each eye. And they are both
[quoted text clipped - 4 lines]
> - view.setLeftProjection(camera);//where camera is a Transform3D with
> a set frustum.
The setLeftProjection() method of View is a low level compatibility
mode method for porting camera-model apps and disables the standard
built-in Java 3D view model (which is not based on a camera, but
rather the locations of the user's eyes in the VirtualUniverse). The
Pick behaviors are utility classes that rely on the standard Java 3D
view model and won't work if you set the projection yourself. You'll
need to use the core Java 3D picking methods in Locale instead, which
are all view-independent, geometry-based methods.
The standard Java 3D view model is capable of generating stereo pairs
on 2 windows by using the the setMonoscopicViewPolicy() method of
Canvas3D with View.LEFT_EYE_VIEW and View.RIGHT_EYE_VIEW respectively
(normally the policy is set to View.CYCLOPEAN_EYE_VIEW). By default
these use the eye positions as set in the PhysicalBody. The
PhysicalBody models the user's head, with its origin set to middle of
the two eye positions. The view model defaults set the origin and
orientation of the PhysicalBody to be the same as the ViewPlatform,
but in units of physical meters instead of virtual units; the scaling
is controlled by View.setScreenScalePolicy() and whatever scaling is
composed into the transform above the ViewPlatform. You only need to
use a single View and ViewPlatform with these two Canvas3D instances.
> - other things like PhysicalBody(), PhysicalEnvironment(),
> GraphicsConfiguration I considered not imporant for this problem.
They're essential to using the standard Java 3D view model and the
Picking utility behaviors though. If you have specific projection
matrices that you must use, then you'll have to code your own picking
behaviors to construct PickShapes that align with your view direction
and individual projection frustums.
The Java 3D view model isn't very well documented unfortunately. I
suggest subscribing to the Java 3D interest forum at
http://forums.java.net/jive/forum.jspa?forumID=70 and searching for
the info you need. To get the real details of what's going on, you
could also try reading the source code to the utility class
com.sun.j3d.utils.universe.ViewInfo, which documents the standard view
model with code.
Good luck -- Mark
Thomas Partsch - 21 Oct 2006 10:01 GMT
Wow, thats lots of information. Thank you very much. I already posted a
question in this forum. I'll have to think about your words later, last
night was too much ;)
greetings
Thomas
Mark Hood schrieb:
>> Ok, thanks. There are some differences to my VirtualUniverse. First, I
>> haven't defined a ViewingPlatform at all, neither a Viewer object. But
[quoted text clipped - 66 lines]
>
> Good luck -- Mark
Thomas Partsch - 22 Oct 2006 17:02 GMT
Hi Mark!
> You only need to
> use a single View and ViewPlatform with these two Canvas3D instances.
If that is correct, then it should be possible to use the SimpleUniverse
like this:
public class TwoBoxes {
private SimpleUniverse universe;
private EyeFrame leftFrame, rightFrame;
private Canvas3D leftCanvas3D, rightCanvas3D;
//PhysXBehavior physXBehavior = new PhysXBehavior();
public TwoBoxes()
{
this.universe = new SimpleUniverse();
//Create the two canvases in a left and right frame
leftFrame = new EyeFrame(EyeFrame.LEFT_EYE,leftCanvas3D);
rightFrame = new EyeFrame(EyeFrame.RIGHT_EYE,rightCanvas3D);
universe.getViewer().getView().addCanvas3D(leftCanvas3D);
universe.getViewer().getView().addCanvas3D(rightCanvas3D);
BranchGroup bgScene = createScene();
//Bounds for Behaviors
BoundingSphere behaviorBounds = new BoundingSphere(new Point3d(0.0,
0.0, 0.0), 100.0);
setupPickBehaviors(bgScene, behaviorBounds);
this.universe.addBranchGraph(bgScene);
}
public BranchGroup createScene() {
// Create the root of the branch graph
BranchGroup scene = new BranchGroup();
[...]
return scene;
}
public static void main(String[] args) {
new TwoBoxes();
}
}
The Canvas3Ds are initialized in the class EyeFrame, where the
MonoscopicViewPolicy is also set.
Unfortunately, the program produces only a white frame, the scenegraph
is obviously not painted. I can't tell why, the code for the scene part
is almost exactly the same as before (with two views and so on...).
Full source code you'll find at
http://www.thomepage.de/kram/java3d/2ndViewTest/
Hope, you can help.
greetings
Thomas
Thomas Partsch - 22 Oct 2006 17:41 GMT
And solved!
Sorry, that really was kind of a 'newbie mistake'... You can't hand over
a null-pointer and then expect a created object.
So now I've got some kind of default view on the scene and can hopefully
change the view by scaling it or something without killing the behaviors...
Thanks, so far.
Thomas
> Hi Mark!
>
[quoted text clipped - 60 lines]
> greetings
> Thomas