www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Yerst on July 09, 2013, 04:53:10 pm

Title: How to bring a Texture on the Model?
Post by: Yerst on July 09, 2013, 04:53:10 pm
Hey!
I'm new to jpct and i don't get how to allocate a texure to a Object3D.
I'm working with blender, and want to use the texture mapping blender applies to the model.
This is where i'm currently stuck:

Code: [Select]
TextureManager tm = TextureManager.getInstance();
tm.addTexture("sand",new Texture(BitmapHelper.rescale(BitmapHelper.convert(this.context.getResources().getDrawable(R.drawable.img1348666104)), 64, 64)));
InputStream dsStream = manager.open("untitled.3ds");
cube = Loader.load3DS(dsStream, 1);

world.addObjects(cube);
As expected it only shows a grey object, not my beautiful sand ;)
Title: Re: How to bring a Texture on the Model?
Post by: Thomas. on July 09, 2013, 05:24:12 pm
Code: [Select]
cube.setTexture("sand");
Title: Re: How to bring a Texture on the Model?
Post by: Yerst on July 09, 2013, 05:40:18 pm
Code: [Select]
TextureManager tm = TextureManager.getInstance();
tm.addTexture("sand",new Texture(BitmapHelper.rescale(BitmapHelper.convert(this.context.getResources().getDrawable(R.drawable.img1348666104)), 64, 64)));
InputStream dsStream = manager.open("untitled.3ds");
cube = Loader.load3DS(dsStream, 1);
for (int i = 0;i<cube.length;i++)
{
cube[i].setTexture("sand");
}
world.addObjects(cube);
nothing changed...
Title: Re: How to bring a Texture on the Model?
Post by: Thomas. on July 09, 2013, 05:53:10 pm
Are these models black? You can try to call cube.calcTextureWrap(), if it helps your models have no texture coordinates.
Title: Re: How to bring a Texture on the Model?
Post by: Yerst on July 11, 2013, 09:34:05 pm
Hey!
Thanks for your help!
I forget to unwrap the model in blender  :-[
The second problem was that i used BitmapHelper.rescale, withouth needing it.
I don't know why, but i had problem by choosing other measurements than 64x64.
Looks fine now!