I was running through the tutorial, and I had a couple little questions about some discrepencies I found from what I expected. Could someone tell me if I might be doing something wrong, or is the tutorial just a little dated?
This is the wiki article I’m talking about:http://www.jmonkeyengine.com/wiki/doku.php?id=our_first_hud_example
- The square Quad that is rendered to the screen does not automatically render to the centre of the screen like the picture suggests. It seems to render in the bottom-left corner of the screen (under the FPS text). In order to centre it, I had to insert the following line into the simpleinit() method:
hudQuad.setLocalTranslation(new Vector3f(display.getWidth() / 2, display.getHeight() / 2, 0));
I assume this is because it defaults to creating the quad at the origin.
2. When I turn on the normals (N-key in SimpleGame), the normals at the corners where the quad WOULD be (ie. centred at 0,0,0) if it wasn't attached to the HUD are drawn. I assume this is a bug?
3. Lastly, when I turn the camera away from the cylinder, the Quad on the HUD dissapears (I'm guessing its culled for some reason). As well, the lighting state for the Quad doesn't seem to be turned off as it should. In order to fix this, I didn't attach the hudNode to the rootNode (ie. the 'rootNode.attachChild(hudNode);' line was removed), and added the following to draw it later:
protected void simpleRender(){
display.getRenderer().draw(hudNode);
}
This cleared up the culling problem AND the lighting problem.
Am I the only one with this problem? Or am I going crazy? :)