www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: smither on September 28, 2010, 05:36:10 pm

Title: Is it possible to change the TextureInfo on the fly?
Post by: smither 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.
Title: Re: Is it possible to change the TextureInfo on the fly?
Post by: EgonOlsen 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.
Title: Re: Is it possible to change the TextureInfo on the fly?
Post by: smither 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
Title: Re: Is it possible to change the TextureInfo on the fly?
Post by: EgonOlsen 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... ???