I’VE DISCOVERED SOMETHING! I think…
In my tower defense game I’m making; I am attaching all of the game to a rootGameNode and then attaching that to rootNode. The niftyNode (see above) I am attaching separately.
[java] rootNode
|
|
|
rootGameNode guiNode
| |
everything else NiftyNode[/java]
The way I code, at the end of my simpleInitGame method I do most of my attaching of the bigger parent Nodes;
[java] rootGameNode.attachChild(sb);
rootGameNode.attachChild(rootTerrainNode);
rootGameNode.attachChild(rootCrittersNode);
rootGameNode.attachChild(rootTowersNode);
rootNode.attachChild(rootGameNode);
rootNode.attachChild(guiNode);
rootNode.updateRenderState();[/java]
And I found through testing that is I attach the guiNode just BEFORE the rootGameNode then it still registers but is invisible. I tracked this down to my skybox which I setup before going all these attachings. The lights played no part, the cullstate of the skybox played no part. This chunk of code, from a tutorial here;
[java] sb = new Skybox("skybox", 200, 200, 200);
try {
ResourceLocatorTool.addResourceLocator(
ResourceLocatorTool.TYPE_TEXTURE,
new SimpleResourceLocator(getClass().getResource(
"/assets/textures/")));
} catch (Exception e) {
System.out.println("Unable to access texture directory.");
e.printStackTrace();
}
sb.setTexture(Skybox.Face.North, TextureManager.loadTexture(
"north.jpg", Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear));
sb.setTexture(Skybox.Face.West, TextureManager.loadTexture("west.jpg",
Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear));
sb.setTexture(Skybox.Face.South, TextureManager.loadTexture(
"south.jpg", Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear));
sb.setTexture(Skybox.Face.East, TextureManager.loadTexture("east.jpg",
Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear));
sb.setTexture(Skybox.Face.Up, TextureManager.loadTexture("top.jpg",
Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear));
sb.setTexture(Skybox.Face.Down, TextureManager.loadTexture(
"bottom.jpg", Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear));
sb.preloadTextures();[/java]
When paired with attaching the rootGameNode (sb's parent) AFTER having attached the guiNode would make the guiNode invisible. Hope this helps somebody else. But I'm still wondering why exactly. I'm not to knowledgable about rendering.