www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Mr. K on April 25, 2016, 10:23:40 am

Title: Problem with textures
Post by: Mr. K on April 25, 2016, 10:23:40 am
Hello it's me again, before thanks for the support
I have an issue with the texture when i use Loeader.LoadOBJ i have the following code

Code: [Select]
try{
                    model = Object3D.mergeAll( Loader.loadOBJ(getResources().getAssets().open("Katarina_Pirate_object.obj"),getResources().getAssets().open("Katarina_Pirate_material.mtl"),10));
                }catch (Exception e){
                    Log.e(TAG,e.getMessage());
                }
                model.setTexture("katarina_pirate_diffuse.png"); // it's the name of the texture in the TextureManager
                model.build();
                world.addObject(model);
but the texture isn't show
Title: Re: Problem with textures
Post by: EgonOlsen on April 25, 2016, 10:39:21 am
Maybe the model has no texture coordinates?
Title: Re: Problem with textures
Post by: Mr. K on April 25, 2016, 10:52:47 am
the  coordinates were given in the mtl file? or in the obj file? wherever, i tried with another obj model and i have the same problem
Title: Re: Problem with textures
Post by: EgonOlsen on April 25, 2016, 10:56:21 am
In the obj file. The mtl only defines the texture names and such.
Title: Re: Problem with textures
Post by: Mr. K on April 25, 2016, 11:19:49 am
Yes, the file obj has the coordinates of the texture, could be a problem whit the lights? or i must add another line of code?
Title: Re: Problem with textures
Post by: Mr. K on April 25, 2016, 11:52:43 am
thanks for the reply i found the solution, really thanks Egon
Title: Re: Problem with textures
Post by: Mr. K on April 29, 2016, 10:32:57 am
Just for the record for load the texture, i put the attribute of material on null and then i followed the tutorial of the wiki

Code: [Select]
try{
                    skin= new Texture(getResources().getAssets().open("Katarina_pirate_diffuse.png"));
                    model = Object3D.mergeAll( Loader.loadOBJ(getResources().getAssets().open("Katarina_Pirate_object.obj"),null,10));
                }catch (Exception e){
                    Log.e(TAG,e.getMessage());
                }

                TextureManager.getInstance().addTexture("Katarina_pirate_diffuse",skin);
                model.setTexture("katarina_pirate_diffuse.png");
                model.build();
                world.addObject(model);