Author Topic: blending texture with textureinfo  (Read 877 times)

Offline nmare

  • byte
  • *
  • Posts: 10
    • View Profile
    • Puzzker
blending texture with textureinfo
« on: January 21, 2013, 02:52:49 am »
hi!

i actually try to transform a texture when an object have a special status.   In this case, a frozen card.   So i have a normal texture for each cards and a icy texture of the same size
using the same uv mapping format.    My objects have their own UV Mapping (Using 3ds), in fact all cards use the same cloned object.

So i want to blend both textures

here the code i use

Code: [Select]
TextureInfo ti = new TextureInfo( TextureManager.getInstance().getTextureID("card" + Integer.toString( CardId+1 )) );
ti.add(TextureManager.getInstance().getTextureID("frozencard"), TextureInfo.MODE_BLEND );
game.card[CardId].setTexture(ti);

If i use only one texture. It work fine.  I can see the card texture or the frozencard texture.   when i try to blend both im getting this error on the setTexture line:

01-20 20:26:20.187: I/jPCT-AE(26561): java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
01-20 20:26:20.187: I/jPCT-AE(26561):    at com.threed.jpct.Object3D.setTexture(Object3D.java:3411)
01-20 20:26:20.187: I/jPCT-AE(26561):    at com.nmare.puzzker.anims.Freeze.FreezeCard(Freeze.java:37)

ti.MAX_PHYSICAL_TEXTURE_STAGES give me 4.

Im out of idea.  Whats wrong? 

Thx for the help
« Last Edit: January 21, 2013, 02:56:52 am by nmare »
DevGeek studio
Indie Developer (android, opengl, databases)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: blending texture with textureinfo
« Reply #1 on: January 21, 2013, 07:33:05 am »
Please try the latest beta version: http://jpct.de/download/beta/jpct-ae.jar. I don't think that this will help, but just to be sure...

If it still doesn't work, please post the exception that this beta version throws.

I think this happens because you are trying to add additional layers after the object has been compiled (and maybe stripped). This isn't supposed to work anyway, because it would require a recompile of the object. Have you tried to add that second layer right after loading the object and initialize it using some transparent texture?




Offline nmare

  • byte
  • *
  • Posts: 10
    • View Profile
    • Puzzker
Re: blending texture with textureinfo
« Reply #2 on: January 21, 2013, 11:10:36 pm »
Hi

Quote
I think this happens because you are trying to add additional layers after the object has been compiled (and maybe stripped). This isn't supposed to work anyway, because it would require a recompile of the object. Have you tried to add that second layer right after loading the object and initialize it using some transparent texture?

woops...    objects are already compiled and stripped when i change the texture.   I had not seen it in the forum... or maybe im blind  ;D

Ok, so i have to destroy my object and then rebuild it with a new skin each time?  Ill give a try.   


Quote
Please try the latest beta version: http://jpct.de/download/beta/jpct-ae.jar. I don't think that this will help, but just to be sure...

My game will be ready for the market in the next month, so i dont want to use a beta version if possible.   


thx for your fast answer like usual  :)
DevGeek studio
Indie Developer (android, opengl, databases)

Offline nmare

  • byte
  • *
  • Posts: 10
    • View Profile
    • Puzzker
Re: blending texture with textureinfo
« Reply #3 on: January 21, 2013, 11:44:55 pm »
Ahahahaha it work now...

But the card look burned instead of frosted...    Will have to work on the blending and the frost texture.      And now i have a Burned card status  ;D
DevGeek studio
Indie Developer (android, opengl, databases)