151
Support / Re: Crash (native)
« on: March 18, 2018, 04:38:30 pm »Yes, it's save and it's cheap. However, compiling the object fixes the texture stage count for it. That's why you are getting that exception with the TextureInfo. YOu could assign a TextureInfo with the same amount of stage but using some dummy textures, compile, assing the actual textures. That should actually work.So I tried this with two TextureInfo's (one 3-layered with dummy textureID and one 3-layered with the actual textureID's) but I am still getting the Exception.
Code: [Select]
final int dummyID = textureManager.getTextureID(textureManager.getNameByTexture(textureManager.getDummyTexture()));
final TextureInfo ti = new TextureInfo(dummyID);
ti.add(dummyID, TextureInfo.MODE_ADD);
ti.add(dummyID, TextureInfo.MODE_ADD);
obj.setTexture(ti);
obj.build();
obj.compile();
obj.strip();
world.addObject(obj);
world.renderScene(frameBuffer);
world.draw(frameBuffer);
This is how I first load the Object3D with 3 (not even sure if it actually gives 3...) texturelayers.
But when I apply the real TextureInfo (after loading Textures and getting their ID's) it will crash:
Code: [Select]
03-18 11:35:18.768: E/AndroidRuntime(4487): java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
03-18 11:35:18.768: E/AndroidRuntime(4487): at com.threed.jpct.Object3D.setTexture(Object3D.java:3660)
When the real TextureInfo only holds one texture(layer) it won't crash... So it doesn't really seem to set 3 layers using the dummy textures or something..?EDIT:
I moved the obj.strip() line to after applying the real TextureInfo, which seemed to fix it...