PNG Textures not loading on HTC desire

Posted by Matthew Tatum on Stack Overflow See other posts from Stack Overflow or by Matthew Tatum
Published on 2010-05-19T18:57:34Z Indexed on 2010/05/19 19:00 UTC
Read the original article Hit count: 184

Filed under:
|
|
|

Hi I'm developing a game for android using OpenGL es and have hit a problem:

My game loads fine in the emulator (windows xp and vista from eclipse), it also loads fine on a T-Mobile G2 (HTC Hero) however when I load it on my new HTC Desire none of the textures appear to load correctly (or at all). I'm suspecting the BitmapFactory.decode method although I have no evidence that that is the problem.

All of my textures are power of 2 and JPG textures seem to load (although they don't look great quality) but anything that is GIF or PNG just doesn't load at all except for a 2x2 red square which loads fine and one texture that maps to a 3d object but seems to fill each triangle of the mesh with the nearest colour).

This is my code for loading images:

     AssetManager am = androidContext.getAssets();
  BufferedInputStream is = null;
  try {
     is = new BufferedInputStream(am.open(fileName));

     Bitmap bitmap;

     bitmap = BitmapFactory.decodeStream(is);

     GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
     bitmap.recycle();
  } catch(IOException e) {
     Logger.global.log(Level.SEVERE, e.getLocalizedMessage());
  } finally {
     try {
        is.close();
     } catch(Exception e) {
        // Ignore.
     }
  }

thanks

© Stack Overflow or respective owner

Related posts about android

Related posts about java