Author Topic: texture problem  (Read 3047 times)

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
texture problem
« on: April 30, 2009, 05:21:31 am »
I haven't loaded any models into my game for quite a while.  I went to make a change and for some reason the model doesn't get a texture anymore.  I'm using the same code and I double checked and I know the texture is being loaded by jpct without error.  But when assigning material I get this line:

Processing new material Nonebrown.jp!

The texture line is:
Code: [Select]
        TextureManager.getInstance().addTexture("brown.jpg", new Texture(this.getClass().getClassLoader().getResourceAsStream("brown.jpg")));

I copied the same name and it shows in my models folder as brown.jpg.

I'm using the same version of Blender which was working fine.

The 3ds load is:
Code: [Select]
        Object3D box1 = loadModel("testC.3ds", 20);
        world.addObject(box1);

The same one I'm using for at least one textured model which is working properly, but now my exported models don't seem to work anymore. 
« Last Edit: April 30, 2009, 05:50:44 am by fireside »
click here->Fireside 7 Games<-

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: texture problem
« Reply #1 on: April 30, 2009, 08:15:53 am »
Have you verified that your texture name is really correct? Loader has a method to extract the texture names from a 3DS. Use that on your model to see what is the exact name.

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Re: texture problem
« Reply #2 on: April 30, 2009, 02:13:03 pm »
This is what I tried:
Code: [Select]
        String[] modelTextures = Loader.readTextureNames3DS(this.getClass().getClassLoader().getResourceAsStream("testC.3ds"));
//        System.out.println("Texture for testC = " + modelTextures[0]);

The commented out line just gives an array index out of bounds, but when it does the material thing for the model it says Nonebrown.jp, so it must be reading the file name.

Edit: I got the test cube to work by applying a material to the model.  I don't remember doing that before but maybe I forgot or something. I thought I was just applying a texture in the image editor before.  I'll have to see if this works for transparency yet.

Another edit: Transparency works, too.  Apparently I forgot about the material.  Now I can get back to my buggy code.
« Last Edit: April 30, 2009, 02:41:32 pm by fireside »
click here->Fireside 7 Games<-

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Re: texture problem
« Reply #3 on: April 30, 2009, 05:41:33 pm »
I guess is due to the name of the texture file

Nonebrown.jp

12 chars

3DS files stores texture names in 8.3 format

inside the map, the referenced texture name is Nonebrown.jp but the file is Nonebrown.jpg

Nada por ahora

Offline fireside

  • double
  • *****
  • Posts: 605
    • View Profile
Re: texture problem
« Reply #4 on: April 30, 2009, 07:23:22 pm »
The "None" was added by jpct, apparently because it couldn't find it or something.  The name of the texture is simply brown.jpg, unless Blender added that to the name for some reason.
click here->Fireside 7 Games<-

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: texture problem
« Reply #5 on: April 30, 2009, 09:25:12 pm »
Name of the material !=  name of the texture. They are read from different chunks from the file at different sections in the code. I'll check for that "None..."-thing. I don't think that jPCT adds this...

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: texture problem
« Reply #6 on: April 30, 2009, 09:56:31 pm »
I've checked it out and there is no code in jPCT that adds a "None" to a materials name. The name is taken directly from the file as a series of bytes, read into a fresh instance of StringBuffer and convertedto the name of the material. There's no "None" added anywhere...