Hello,
currently I am trying to display my own mouse pointer. I use the code provided in the mouse picking example, but my mousepointer isn't transparent -> i can see a black or white rectangle around it. I guess it has to do with the transparency of the picture I use (has no alpha channel). Is it possible to say that for example all white pixel in the pointer image should be transparent? Thats the code I use:
absMouse = new AbsoluteMouse("my mouse", display.getWidth(), display.getHeight());
URL url = this.getClass().getClassLoader().getResource("textures/cursor.png");
//URL url = this.getClass().getClassLoader().getResource("jmetest/data/cursor/cursor1.png");
Texture t = TextureManager.loadTexture(url, Texture.MM_LINEAR, Texture.FM_LINEAR);
TextureState ts = display.getRenderer().createTextureState();
ts.setTexture(t);
absMouse.setRenderState(ts);
AlphaState as = display.getRenderer().createAlphaState();
as.setBlendEnabled(true);
as.setSrcFunction(AlphaState.SB_SRC_ALPHA);
as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);
as.setTestEnabled(true);
as.setTestFunction(AlphaState.TF_GREATER);
absMouse.setRenderState(as);
absMouse.setLocalTranslation(new Vector3f(display.getWidth() / 2, display.getHeight() / 2, 0));
absMouse.registerWithInputHandler( input );
rootNode.attachChild(absMouse);
Thx for your help!