2

I am trying to load some textures in my android application.

It works well on all the devices like samsung galaxy ace, s2 but any device using PowerVR SGX540 gpu, e.g. samsung galaxy S-gti9000
will have some weird artifacts....

Some textures are loaded correctly... but other textures are completely black....

I have made sure that all my textures are power-of-two, but they are not square and can be rectangular e.g. 64*128.

I am using the following for texture paramaters settings....

gl.glActiveTexture(GL10.GL_TEXTURE0);               
gl.glBindTexture(GL10.GL_TEXTURE_2D, glTextureId);
gl.glTexParameterf(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER, gl.GL_LINEAR);
gl.glTexParameterf(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER, gl.GL_LINEAR); 
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
revolutionary
  • 3,314
  • 4
  • 36
  • 53
  • Are you using bitmapFactory to decode your resources? Sometimes it shrinks/enlarges images based on the screen density. – Tim Aug 21 '12 at 01:20
  • Hi Tim, not BitmapFactory... but using ETC textures with ETC1Util.createTexture()... i checked the dimensions of all my textures now and they are all power of two as expected... – revolutionary Aug 21 '12 at 14:04
  • it is surprising that some textures are loaded perfectly but others are not – revolutionary Aug 21 '12 at 14:04

1 Answers1

1

As Tim suggests, it could be android helpfully resizing your images to match the dpi of different devices.

Check the size of the images once their loaded to ensure that they're still power-of-two. Putting the resource files in res/drawable-nodpi should let android know that you don't want them resized.

ryanm
  • 2,979
  • 18
  • 22
  • hi, there is only one bitmap that i am using like Bitmap.createBitmap(256, 256, Bitmap.Config.RGB_565); The rest of them are loaded as the ETC texture directly from inputsrteam using ETC1Util.createTexture(inputsrteam ); – revolutionary Aug 21 '12 at 13:45
  • I checked also that some of my mip maps have dimension less than 2 like 1*1 – revolutionary Aug 21 '12 at 13:55