Author Topic: Problem with textures  (Read 2862 times)

Offline Mr. K

  • byte
  • *
  • Posts: 17
    • View Profile
Problem with textures
« 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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Problem with textures
« Reply #1 on: April 25, 2016, 10:39:21 am »
Maybe the model has no texture coordinates?

Offline Mr. K

  • byte
  • *
  • Posts: 17
    • View Profile
Re: Problem with textures
« Reply #2 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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Problem with textures
« Reply #3 on: April 25, 2016, 10:56:21 am »
In the obj file. The mtl only defines the texture names and such.

Offline Mr. K

  • byte
  • *
  • Posts: 17
    • View Profile
Re: Problem with textures
« Reply #4 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?

Offline Mr. K

  • byte
  • *
  • Posts: 17
    • View Profile
Re: Problem with textures
« Reply #5 on: April 25, 2016, 11:52:43 am »
thanks for the reply i found the solution, really thanks Egon

Offline Mr. K

  • byte
  • *
  • Posts: 17
    • View Profile
Re: Problem with textures
« Reply #6 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);