Textures are white on Droid (and not other phones)

by Barrett_A » Sat, 27 Feb 2010 05:05:30 GMT


Sponsored Links
 I'm using GLSurfaceView to render OpengGL 3D.  It works great on my
nexus one, the emulators, and at least the G1.  However, on the droid,
the textures are white.  I've seen this problem before when textures
aren't loaded, and also when they aren't powers of two dimensions (not
the case here).  What's weird is that this started when I converted my
program to use GLSurfaceView (it used to be based on some older
example where I was doing the EGL stuff myself).

Textures displayed on the screen are white, but shapes that are just
colors are displayed just fine.

The person testing this for me on their droid does not have the sdk,
so if anyone would like to run this with the debugger, let me know and
I can get you the apk.

Thanks for any help!

--



Textures are white on Droid (and not other phones)

by Robert Green » Sat, 27 Feb 2010 11:31:11 GMT


 Your textures are being scaled and are no longer power-of-two.  Either
put them in drawable-nodpi or turn off scaling on the decoder
configuration.




--


Sponsored Links


Textures are white on Droid (and not other phones)

by Barrett_A » Sat, 27 Feb 2010 11:34:36 GMT


 I have them in just plain old drawable (added this directory myself
since this is how it used to be done, didn't do anything special, if
something special is required).

They work fine on my Nexus One, which is also HDPI (I assume).  Does
Nexus One default to not scale while Droid does scale?

Thanks





--



Textures are white on Droid (and not other phones)

by Robert Green » Sat, 27 Feb 2010 11:35:50 GMT


 Actually, I just noticed that you said it works on the n1.  My
previous guess is probably wrong then...




--



Textures are white on Droid (and not other phones)

by Barrett_A » Sat, 27 Feb 2010 13:56:13 GMT


 efore posting here, I googled this issue, and did find one other
unsolved thread about this same issue.
If anyone else comes here after googling, here's information about
what happened between it not working and working:
(I'm not sure which of these steps is what fixed it, and I don't
intend to find out :))

I got rid of everything GL11 (everything is GL10 now).

I changed my LoadTexture function from:

int LoadTexture(int resID,GL10 gl){
Resources res = gp.getContext().getResources();
Bitmap bmp = BitmapFactory.decodeResource(res,resID);
int[] tmp_tex = new int[1];
gl.glGenTextures(1, tmp_tex, 0);
int tex = tmp_tex[0];
gl.glBindTexture(GL10.GL_TEXTURE_2D, tex);
gl.glTexParameterf(GL10.GL_TEXTURE_2D,
GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D,
GL10.GL_TEXTURE_MAG_FILTER, GL10.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);
gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_ALPHA,
GL10.GL_ALPHA_BITS);
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bmp, 0);
bmp.recycle();
return tmp_tex[0];
}




to



int LoadTexture(int resID,GL10 gl)
{
int[] textures = new int[1];
gl.glGenTextures(1, textures, 0);
int mTextureID = textures[0];
gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureID);
gl.glTexParameterf(GL10.GL_TEXTURE_2D,
GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_NEAREST);

gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MAG_FILTER,GL10.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);
gl.glTexEnvf(GL10.GL_TEXTURE_ENV,
GL10.GL_TEXTURE_ENV_MODE,GL10.GL_REPLACE);
InputStream is =
gp.getContext().getResources().openRawResource(resID);
Bitmap bitmap;
try {
bitmap = BitmapFactory.decodeStream(is);
} finally {
try {
is.close();
} catch(IOException e) {
// Ignore.
}
}
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
bitmap.recycle();
return mTextureID;
}
}


(I found the body of this in the ApiDemo with the 3 letters on a
textured triangle spinning).
Only a few differences, but they are there.

Again, I'm not sure which of those two things is what fixed it (and
it's even possible that it was something else that I don't remember
doing).

Hopefully this helps someone else.

(and thanks to R. Green for testing it on his Droid).


On Feb 26, 2:05pm, Barrett_A <lbarrettander...@gmail.com> wrote:

--



Textures are white on Droid (and not other phones)

by Robert Green » Sat, 27 Feb 2010 22:23:14 GMT


 I don't have access to my Droid at the moment but my guess is that it
maybe didn't like that alpha bits texture parameter? Perhaps you could
just try without that.  The minimal parameters that you need are the s
and t clamp method and the minification and magnification function.  I
recommend testing with only those when you are having major issues on
a specific chip.




--



Textures are white on Droid (and not other phones)

by Robert Green » Sat, 27 Feb 2010 22:27:44 GMT


 Oh.. yeah, you should run in the native Res by setting the supports
screen flags in the manifest and then use drawable-nodpi.  Both phones
should scale the same but it depends on the manifest.  I actually
think that the n1 may support non power of twos but I don't have the
extension list in front of me.




--



Other Threads

1. sdcard mount problem-"Volmgr not ready to handle device" error

Hi,
 I'm porting android 1.6 to our omap 3530 based board.

We have two partition in our sdcard.

1. mmcblk0p1- rootfs(containing android file system) -ext3 type

2. mmcblk0p2 - this had to be mounted as /sdcard - vfat type.

When android got boots in, sdcard partition /dev/mmcblk0p2 didn't get
mounted in /sdcard.
I have configured vold.conf correctly as below
    media_path /devices/platform/mmci-omap-hs.0/mmc_host/mmc0



 I get following message from logcat

I/vold    (  658): New MMC card 'SD01G' (serial 2478986119) added @ /
devices/pla
tform/mmci-omap-hs.0/mmc_host/mmc0/mmc0:6d66
I/vold    (  658): Disk (blkdev 179:0), 1939456 secs (947 MB) 2
partitions
I/vold    (  658): New blkdev 179.0 on media SD01G, media path /
devices/platform
/mmci-omap-hs.0/mmc_host/mmc0/mmc0:6d66, Dpp 2
I/vold    (  658): Partition (blkdev 179:1), 991938 secs (484 MB) type
0xb
I/vold    (  658): New blkdev 179.1 on media SD01G, media path /
devices/platform
/mmci-omap-hs.0/mmc_host/mmc0/mmc0:6d66, Dpp 1
I/vold    (  658): Partition (blkdev 179:2), 947422 secs (462 MB) type
0x83
I/vold    (  658): New blkdev 179.2 on media SD01G, media path /
devices/platform
/mmci-omap-hs.0/mmc_host/mmc0/mmc0:6d66, Dpp 0
I/vold    (  658): Evaluating dev '/devices/platform/mmci-omap-hs.0/
mmc_host/mmc
0/mmc0:6d66/block/mmcblk0' for mountable filesystems for '/sdcard'
I/vold    (  658): Aborting start of /sdcard (bootstrap = 1)
I/vold    (  658): Volmgr not ready to handle device
E/vold    (  658): Unable to open '/sys/class/switch' (No such file or
directory
)
D/vold    (  658): Bootstrapping complete


It appears to me that, uevent for mounting sdcard arrives, even before
bootstrapping finishes out (not sure), which leads to aborting of
mouting of sdcard.

 What could be the cause of this issue??. Please give me suggestions
to fix up the issue.

regards,
P.Arun



-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. How to change the color depth of Android from 16 bpp to 24 bpp.

My lcd supports 24 bpp(RGB888) and it can work normal in
bootloader. I know the default setting of Android is 16 bpp. How do I
change it to 24 bpp.

  In frameworks/base/libs/surfaceflinger/, it has many color
conversion from 24 bpp to 16 bpp, Do I modify these?


Thanks for anyone attention to this topic.

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. SD Card Automount Problem with Android 1.6

4. is it possible to increase the dns number by simply changing MAXNS in resolv_private.h?

5. Dalvik JAR in Eclipse

6. Android Source Code Downloading & Buildin

7. Using the serial port on the g1