Few Textures are not loading into the model

Started by SumiGhosh, August 20, 2015, 07:23:46 AM

Previous topic - Next topic

SumiGhosh

Hi,

below is my code


TextureManager.getInstance().addTexture("james_body_lores.jpg", new Texture(getAssets().open("james_body_lores.jpg")));
TextureManager.getInstance().addTexture("james_face_color_lores.jpg", new          Texture(getAssets().open("james_face_color_lores.jpg")));
TextureManager.getInstance().addTexture("james_eye_green_lores.jpg", new Texture(getAssets().open("james_eye_green_lores.jpg")));
TextureManager.getInstance().addTexture("james_mouth_gum_lores.jpg", new Texture(getAssets().open("james_mouth_gum_lores.jpg")));
TextureManager.getInstance().addTexture("james_penis_lores.jpg", new Texture(getAssets().open("james_penis_lores.jpg")));
TextureManager.getInstance().addTexture("james_toenails_lores.jpg", new Texture(getAssets().open("james_toenails_lores.jpg")));
TextureManager.getInstance().addTexture("james_tongue_bump_lores.jpg", new Texture(getAssets().open("james_tongue_bump_lores.jpg")));
TextureManager.getInstance().addTexture("mpants2tex.jpg", new Texture(getAssets().open("mpants2tex.jpg")));
TextureManager.getInstance().addTexture("mcasshoe1tex.jpg", new Texture(getAssets().open("mcasshoe1tex.jpg")));
TextureManager.getInstance().addTexture("james_eye_inner_green.jpg", new Texture(getAssets().open("james_eye_inner_green.jpg")));
TextureManager.getInstance().addTexture("james_eyelashbottran.jpg", new Texture(getAssets().open("james_eyelashbottran.jpg")));
TextureManager.getInstance().addTexture("james_eyelashtoptran.jpg", new Texture(getAssets().open("james_eyelashtoptran.jpg")));
TextureManager.getInstance().addTexture("msock2rtex.jpg", new Texture(getAssets().open("msock2rtex.jpg")));
TextureManager.getInstance().addTexture("mtshirt3tex.jpg", new Texture(getAssets().open("mtshirt3tex.jpg")));
TextureManager.getInstance().addTexture("weavebumpbig4p6.jpg", new Texture(getAssets().open("weavebumpbig4p6.jpg")));
TextureManager.getInstance().addTexture("allback_blacktx.jpg", new Texture(getAssets().open("allback_blacktx.jpg")));
TextureManager.getInstance().addTexture("allback_tr.jpg", new Texture(getAssets().open("allback_tr.jpg")));



I am able to see only few textures on the model. I am using square images for all the texture. I have also attached log of the app.

Update:
I have also tried with loading images which not power of 2 like this

InputStream is=null;
    try {
is = getAssets().open("mcasshoe1tex.jpg");
Bitmap bitmap = BitmapHelper.rescale(BitmapFactory.decodeStream(is), 1024, 1024);
Texture texture = new Texture(bitmap);
bitmap.recycle();
TextureManager.getInstance().addTexture("mcasshoe1tex.jpg", texture);
           }catch(Exception e){}

EgonOlsen

It's better to rescale non-power-of-2-textures in a preprocessing step, not in the code itself. Anyway...a log output like this


08-20 10:40:57.657    1407-1455/com.threed.jpct.example I/jPCT-AE﹕ Texture named james_mouth_gum_lores.jpg added to TextureManager!


shows that there's no texture named "james_mouth_gum_lores.jpg" in the TextureManager. Looking at your code, I would assume that there is though. But then again, the log doesn't show this. I can only see two "loading texture" outputs in the log. Are you really sure that you are actually calling the texture load code that you've posted?

SumiGhosh

Hi EgonOlsen,

I too have seen only two textures are loading out of 16 log output. Sorry, by the way what you meant by actually calling the texture load code.

I have attached hello world code.


EgonOlsen

I think that something goes wrong in the loading process, but you simply swallow the exception. Remove the try-catch-block around the loading code or at least do something like


}catch(Exception e){
throw new RuntimeException(e);
}


to see what's going on.

SumiGhosh

Hi,

You were right, it was file not found exception, i have dropped few images in drawables instead of assets folder. That's why texture is not showing.