I am trying to create a sky box using the background class and some
simple geometry. Needless to say I am not having a lot of success. Has
anyone done this before?
Currently I am getting a giant sphere in the middle of my screen that
has no texture and doesn't appear to be remotely close to the effect
that I am trying to achieve. The following is a code segment for how I
am trying to implement it:
protected BranchGroup createBackgroundBranchGroup (){
// Set background
BufferedImage image = null;
URL url = null;
url =
getClass().getResource("/ca/beq/realdesk/layout/sky_front.jpg");
LOG.info("url = " + url);
if (url != null) {
try {
image = ImageIO.read(url.openStream());
} catch (IOException e) {
LOG.info("no background image opened");
}
}//if
int icFormat = ImageComponent.FORMAT_RGB;
if (image !=null) {
LOG.info("bg image is not null");
ImageComponent2D imageComponent= new
ImageComponent2D(icFormat,image);
if (imageComponent != null){
//I make it to here no problem and can display a
//background image, but can't get the sky sphere to work
//properly
Appearance sphereAppearance = new Appearance();
Texture2D sphereTexture = new
Texture2D(1,5,256,256);
sphereTexture.setImage(0,imageComponent);
sphereAppearance.setTexture(sphereTexture);
Sphere sphere = new Sphere(10f,
sphereAppearance);
BranchGroup branch = new BranchGroup();
branch.addChild(sphere);
Background bg = new Background(branch);
bg.setImage(imageComponent);
bg.setApplicationBounds(new BoundingSphere(new
Point3d(), 1000));
return branch;
}
}//if
return new BranchGroup();
} // createBackgroundBranchGroup ()
Any insight would be greatly appreciated.
Thanks,
Jeremy
===========================================================================
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".