Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Azzy Elvul

#1
Support / Re: Problem with rotating a box.
September 12, 2012, 08:42:45 AM
Thank you. The emulator was the problem.
#2
Support / Problem with rotating a box.
September 11, 2012, 03:57:24 PM
Hello,
I have box with removed one face with applied texture. I use blender to create the box and export it into obj file  ( see  box_obj and box_mtl files)
I import the box file with this code:
InputStream objStream1 = getResources().openRawResource( getResources().getIdentifier( "com.threed.jpct.example:raw/box_obj", null, null ) );
InputStream mtlStream1 = getResources().openRawResource( getResources().getIdentifier( "com.threed.jpct.example:raw/box_mtl", null, null ) );

box = com.threed.jpct.Loader.loadOBJ( objStream1, mtlStream1, 3.0f )[0];
if ( null != box )
{
//box.invert();
box.setCulling( Object3D.CULLING_DISABLED );
box.setEnvmapped( Object3D.ENVMAP_DISABLED );

box.setTexture( "texture" );
//box.calcNormals();
box.rotateX( 90 );
box.build();
box.compile();
world.addObject(box);
box.translate( 0.f, 0.f, 0.f );
}


There are 2 problems:
1. The applied texture from mtl file not shown. The texture exist in drawable and
I can apply it on object using this code:
InputStream is = getResources().openRawResource(R.drawable.grid);
Bitmap bitmap  = BitmapFactory.decodeStream(is);
Texture texture = new Texture(bitmap);
TextureManager.getInstance().addTexture("texture", texture);
and set it with box.setTexture( "texture" );
Maybe the file is ok because I see the correct object using 3D Model Viewer (  http://www.janbirsa.com/tools/ModelViewer/ )

2. With applied texture when I rotate the box ( with rotateXXX or rotateAxis ) the result is something like box.jpg

Maybe I miss something.


[attachment deleted by admin]