ZOrder not working with com.jme.input.Mouse

During initialization of "com.jme.input.Mouse" the constructor sets ZOrder to (Integer.MIN_VALUE). However that values does not seem to work correctly. Strangely enough, the smallest value to work is (Ingeger.MIN_VALUE + 4). This behavior might be system specific, so I'm posting the test code on the forum. If you are reading this, could you please verify if you have a similar problem.



My system is: Linux 32 bit (Ubuntu feisty), Geforce 7600 (latest drivers), Java 6.



Test code.

The mouse pointer (using default texture) should not be occluded by the white box. Press SPACEBAR to toggle between the two different ZOrder values for the mouse.



import java.net.URL;

import com.jme.app.SimpleGame;
import com.jme.input.AbsoluteMouse;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.renderer.Renderer;
import com.jme.scene.shape.Quad;
import com.jme.scene.state.LightState;
import com.jme.scene.state.TextureState;
import com.jme.util.TextureManager;

public class PointerBugTest extends SimpleGame {

   private KeyBindingManager keyboard;
   private AbsoluteMouse mouse;
   private Quad quad;
   private int defaultZOrder;
   private int workingZOrder = Integer.MIN_VALUE + 4;
   
   private String cmdToggleZOrder = "toggleZOrder";
   
   protected void simpleInitGame() {
      keyboard = KeyBindingManager.getKeyBindingManager();
      keyboard.add(cmdToggleZOrder, KeyInput.KEY_SPACE);
      
      mouse = new AbsoluteMouse("Test Mouse",
            display.getRenderer().getWidth(),
            display.getRenderer().getHeight());
      mouse.registerWithInputHandler(input);
      TextureState ts = display.getRenderer().createTextureState();
      ts.setTexture(TextureManager.loadTexture((URL)null));
      mouse.setRenderState(ts);
      rootNode.attachChild(mouse);
      
      defaultZOrder = mouse.getZOrder();
      
      float width = 100;
      float height = 100;
      quad = new Quad("myQuad", width, height);
      quad.setLocalTranslation(width/2 + 5, height/2 + 50, 0);
      quad.setRenderQueueMode(Renderer.QUEUE_ORTHO);
      //quad.setCullMode(SceneElement.CULL_NEVER);
      quad.setLightCombineMode(LightState.OFF);
      rootNode.attachChild(quad);
   }
   
   protected void updateInput() {
      super.updateInput();
      
      if (keyboard.isValidCommand(cmdToggleZOrder, false)) {
         int newZOrder;
         if (mouse.getZOrder() == defaultZOrder)   newZOrder = workingZOrder;
         else newZOrder = defaultZOrder;
         
         mouse.setZOrder(newZOrder);
         System.out.println("Mouse ZOrder is set to " + newZOrder +
               ". Quad ZOrder is " + quad.getZOrder());
      }
   }
   
   public static void main(String[] args) {
      PointerBugTest game = new PointerBugTest();
      game.setDialogBehaviour(
            SimpleGame.ALWAYS_SHOW_PROPS_DIALOG);
      game.start();
   }
}

This piece is still bothering me.

Can anyone please run the test and either confirm or disconfirm the problem!

Confirmed. The mouse is occluded when zOrder is -2147483648 and not occluded when zOrder is -2147483644.



Windows XP SP2

Geforce 4Ti

jME from CVS

This is now fixed in cvs.

Thanx!