How to bring a Texture on the Model?

Started by Yerst, July 09, 2013, 04:53:10 PM

Previous topic - Next topic

Yerst

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:


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 ;)

Thomas.


Yerst

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

Thomas.

Are these models black? You can try to call cube.calcTextureWrap(), if it helps your models have no texture coordinates.

Yerst

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!