Can't get the right texture on this billboard

I have this class, Photon, which is a Node.



Everytime the "spaceship" shoots, I create a instance of this class, and it's supposed to create a Billboard containing the "star.png" texture from the jmetest (it does load it correctly), and attach the billboard to itself.



But, the texture seems to get "lost" or somehow is replaced by another texture that I loaded previously.


package game;

import com.jme.image.Texture;
import com.jme.scene.BillboardNode;
import com.jme.scene.Node;
import com.jme.scene.shape.Quad;
import com.jme.scene.state.TextureState;
import com.jme.system.DisplaySystem;
import com.jme.util.TextureManager;

public class Photon extends Node {

   private static final long serialVersionUID = 1L;

   public Photon() {
      super("Photon");

      TextureState textureState = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
      textureState.setEnabled(true);

      Texture t = TextureManager.loadTexture(Photon.class.getClassLoader().getResource("jmetest/data/texture/star.png"), Texture.MM_LINEAR, Texture.FM_LINEAR);
      textureState.setTexture(t);
      
      Quad q = new Quad("Quad");
      q.initialize(0.3f, 0.3f);
      q.setRenderState(textureState);

      
      BillboardNode billboard = new BillboardNode("Billboard");
      billboard.setAlignment(BillboardNode.SCREEN_ALIGNED);
      billboard.attachChild(q);

      attachChild(billboard);

   }
}



I can't notice anything wrong with the code. Any ideas?


ps.
In the class "Ship", I have a method:

shoot() {
  myPhotons.add(new Photon());
}

Try updating the render state on that Node or on the parent Node.

Yeaaaa :smiley: works…thanks

np