Shaun Shepherd wrote:
> In VRML code, multiple images can be laid around the camera using frontURL,
> backURL, etc. This gives a 3 dimensional background effect. Can anything
> similar be done in java3d? All I get is one image always following the
> rotation of my camera. Thanks in advance!
The background node can take any kind of geometry. Here's an example
with a sphere which has an image mapped onto its inside. It will be
scaled to infinite size, you can never reach it, plus it seem not to
move relative to the viewport which is really cool.
BoundingSphere backBounds = new BoundingSphere(new Point3d(),
Double.MAX_VALUE);
Background bg = new Background();
bg.setApplicationBounds(backBounds);
BranchGroup backGeoBranch = new BranchGroup();
Sphere sphereObj = new Sphere(1.0f, Sphere.GENERATE_NORMALS |
Sphere.GENERATE_NORMALS_INWARD |
Sphere.GENERATE_TEXTURE_COORDS, 45);
Appearance backgroundApp = sphereObj.getAppearance();
backGeoBranch.addChild(sphereObj);
bg.setGeometry(backGeoBranch);
objRoot.addChild(bg);
java.net.URL bgImage = null;
try {
bgImage = new java.net.URL("file:media/images/bg.jpg");
} catch (java.net.MalformedURLException ex) {
System.out.println(ex.getMessage());
}
TextureLoader tex = new TextureLoader(bgImage, new
String("RGB"), mainFrame);
if (tex != null) {
backgroundApp.setTexture(tex.getTexture());
}
Regards
Nikolai
----------------------------------------------
Nikolai V. Christensen, Computer Engineer,
Simulation and Training department
IFAD, Forskerparken 10A, DK-5230 Odense M
Phone: +45 63 15 71 31 Fax: +45 65 93 29 99
WWWeb: http://www.ifad.dk
e-mail: [EMAIL PROTECTED]
----------------------------------------------
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".