I want to transform my background sphere to create a day/night cycle type effect (starting out by using a simple blue+sun -> black+moon background texture and rotating the whole thing around) but (imagine my surprise) I don't seem to be able to access it. The relevant scenegraph code looks like this:
Background bg = new Background();
BranchGroup bgGeometry = new BranchGroup();
Appearance App = new Appearance();
Texture tex = new TextureLoader(new java.net.URL(filePath+"skysec2.jpg"), this).getTexture();
System.out.println("Looks like the background loaded!");
catch (Exception e)
Sphere outerWorld = new Sphere( 1.0f, Primitive.GENERATE_TEXTURE_COORDS | Primitive.GENERATE_NORMALS_INWARD, App);
TransformGroup outerGit = new TransformGroup();
SkyBehaviour bav = new SkyBehaviour(outerGit);
The error comes during the initialisation of the SkyBehaviour, where I get a NullPointerException in Transform3D.getWithLock from TransformGroupRetained.getTransform from a normal TransformGroup.getTransform, which is called when I first try and read the transform of the transformgroup. It looks to me as though this is something to do with it's priviledged position as part of the Background geometry. But that would be really
annoying, so surely it can't
be the case...
Am I doing something obviously wrong? Is there any easy way to move the background geometry or to move the texture on it?