SharedBatch + target & TextureState


I loading a collada model with the ColladaImporter. Now I want to change some TextureState's in this model. The last elements in the hierarchy are a SharedBatch with a TriangleBatch as target.

For this elements I want to change the TextureState (adding some dynamic text to the existing texture).

So I wrote the following:


      this.sharedLabel = ((SharedMesh) model.getChild("sharedBoardNodeLabel-mesh")).getBatch(0);
      this.targetLabel = sharedLabel.getTarget();

      graphics = ImageGraphics.createInstance(512, 32, 0);
      TextureState oldState = (TextureState) targetLabel.getRenderState(RenderState.RS_TEXTURE);
      labelTextureState =DisplaySystem.getDisplaySystem().getRenderer().createTextureState();

      labelTexture = new Texture();
      labelTexture.setScale(new Vector3f(3f, -1f, 1f));

      labelTextureState.setTexture(labelTexture, 0);

      targetLabel.copyTextureCoordinates(0, 1, 1);

adding some text:

public void addText(String newText) {
      GameTaskQueueManager.getManager().update(new Callable<Object>() {
         public Object call() throws Exception {
            graphics.drawString(newText, 24, 100);

            return null;

The first time I call "addText" the text is added to the texture. But when I do it a second or more times, nothing happens. Im totally confused, tried alot but nothing seems to work.
The TextureState connection between the SharedBatch and TriangleBatch is also an understanding problem for me.

try setting the texture on the actual geometry.

u can get the geometry trimeh object by using sharedNode.getTarget();

Thanks for reply.

I have more than one instances of this model. So I cant set it to the geometry.