Author Topic: Is it possible to change the TextureInfo on the fly?  (Read 1476 times)

Offline smither

  • byte
  • *
  • Posts: 13
    • View Profile
Is it possible to change the TextureInfo on the fly?
« on: September 28, 2010, 05:36:10 pm »
I'm trying to accomplish an animation changing the texture, I'm not using setTexture to do it, because i build the texture using TextureInfo and addTriangle..., it works fine for the initial texture, but when i try to do the same once the scene is already displayed nothing happens.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Is it possible to change the TextureInfo on the fly?
« Reply #1 on: September 28, 2010, 05:59:21 pm »
I don't get it. You can use setTexture with a TextureInfo too!? What you can't do, is to change the texture of only some polygons after the compilation of the object took place. Well, there is a way to do it, but it's not recommended to do this, because it requires an expensive recompile every time.
« Last Edit: September 28, 2010, 08:52:42 pm by EgonOlsen »

Offline smither

  • byte
  • *
  • Posts: 13
    • View Profile
Re: Is it possible to change the TextureInfo on the fly?
« Reply #2 on: September 28, 2010, 06:54:44 pm »
Code: [Select]
Object3D template=new Object3D(4);
TextureManager tm=TextureManager.getInstance();
TextureInfo tInfo=new TextureInfo(tm.getTextureID(Globals.TextureGoalKeeper2), 0, 0, 0, 1, 1, 0);
template.addTriangle(new SimpleVector(0,0,0), new SimpleVector(0,0,-10),new SimpleVector(10,0,0), tInfo);
tInfo=new TextureInfo(tm.getTextureID(Globals.TextureGoalKeeper2), 1, 0, 0, 1, 1, 1);
template.addTriangle(new SimpleVector(10,0,0), new SimpleVector(0,0,-10),new SimpleVector(10,0,-10), tInfo);
That's how i'm setting the texture to the object

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Is it possible to change the TextureInfo on the fly?
« Reply #3 on: September 28, 2010, 08:52:22 pm »
As long as the u/v-coordinates doesn't change, you can simply use setTexture(...) to update the texture. I don't get the problem right now... ???