Is it possible to change the TextureInfo on the fly?

Started by smither, September 28, 2010, 05:36:10 PM

Previous topic - Next topic

smither

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.

EgonOlsen

#1
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.

smither

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

EgonOlsen

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... ???