Skip to main content

Integrating Java 3D App

4 replies [Last post]
gohcheeying
Offline
Joined: 2004-07-01

Hi,

I am new to Looking Glass.
I understand that LG3D is built on Java 3D.
How do I integrate my Java3D app into LG3D?

thanks and regards,
josiah goh

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
dwarfy
Offline
Joined: 2004-12-16

Hi !
Here is an example of how to include a j3d branchgroup in a lg3d application.

It is pretty simple.

[code]
Java3DGraph j3dwrap = new Java3DGraph();
BranchGroup objRoot = new BranchGroup();

switchNode = new Switch(Switch.CHILD_MASK);
switchNode.setChildMask(boolMatrix);
switchNode.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
switchNode.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);

for (int x=0;x for (int y=0;y TransformGroup a = new TransformGroup();

Box b = new Box(itemInnerWidth / 2,itemHeight / 2,itemInnerWidth / 2,Box.GENERATE_NORMALS,itemApp);
a.addChild((javax.media.j3d.Node) b.getWrapped().getWrapped()); //?

Vector3f v = new Vector3f(((x * itemWidth) + itemBorderWidth + (itemInnerWidth/2)),0f,((y * itemWidth) + itemBorderWidth + (itemInnerWidth /2 )));
Transform3D t = new Transform3D();
t.setTranslation(v);
a.setTransform(t);

switchNode.addChild(a);
}
}

objRoot.addChild(switchNode);
j3dwrap.addJ3dChild(objRoot);
[/code]

the interesting part is :
[code]
Java3DGraph j3dwrap = new Java3DGraph();
[/code]

However only a subset of java3d classes are integrated in lg3d and in addition, all the view/canvas3d/screen3D ... part of the scenegraph is handled by lg3d and couldn't be exactly what you need for you application...

One of the project owners will maybe answer better than I.
So wait for them...

Cheers,
Dwarfy

Message was edited by: dwarfy

gohcheeying
Offline
Joined: 2004-07-01

Many thanks.

The code sure looks simple enough.
Any pointers to documentation on which Java3D classes are supported?

best regards,
josiah goh

hideya
Offline
Joined: 2003-07-22

> Any pointers to documentation on which Java3D classes are supported?

As far as I know, you can attach any kind of Java 3D scenegraph classes rooted by BranchGraph (paulby knows better, but he's on vacation now). Please try some and let us know if you find any issue.

hideya

paulby
Offline
Joined: 2003-06-13

You can attach any Java3D SceneGraph Node and NodeComponent to LG3D.