small medium large xlarge

15 Apr 2012, 02:50
Gerard Gilliland (1 post)

Overview: I could not get the texture to show on the Droid Razr. But it would display on the Eclipse Emulator. The following code changes allowed me to display it on the Droid Razr.

Droid Razr: Android version 2.3.6 Eclipse Emulator: Android version 2.3.3 The following code is in OpenGL.GLCube.loadTexture.

Code#1 (New code not in the original) — OpenGL texture works on the Droid Razr if I use:

  InputStream is = context.getResources().openRawResource(resource);
  Bitmap bmp = BitmapFactory.decodeStream(is);

Code#2 (Original from the book) — The texture fails to display if I use:

  Bitmap bmp = BitmapFactory.decodeResource(context.getResources(),

Notes: Code#1 required adding “import;” to The ‘resource’ (2130837504) converted to hex and viewed in R.drawable matches ‘android’ I call .getWidth, and .getHeight and output resource and the size results on LogCat: The android bitmap is 128x128 When I read it with Code#1 I get 128x128 when I read it with Code#2 I get 192x192 Both Code#1 and Code#2 work on the emulator.

Success (The Texture is displayed): Droid Razr: 04-13 09:52:09.189: D/GLCube(14937): Code#1 resource:2130837504 size(128x128) Emulator: 04-13 15:56:20.731: D/GLCube(334): Code#1 resource:2130837504 size(128x128) 04-13 15:58:16.841: D/GLCube(369): Code#2 resource:2130837504 size(192x192)

Failure on Droid Razr (The Cube is White with no Texture): 04-13 10:01:14.312: D/GLCube(15210): Code#2 resource:2130837504 size(192x192)

The following error message on LogCat probably means something – it occurs when running the Droid Razr not on the emulator: It shows up one line before my Log message that shows the bitmap size and shows up with both Code#1 and Code#2. 04-13 10:01:14.226: I/IMGSRV(15210): IMGeglCreateWindowSurface:2974 Warning: using custom HW EGL config with EGL_DEPTH_SIZE=16 When I googled the error message the only hits I got were people reporting the same error. Thank you.

18 Apr 2012, 10:49
Roar S. (3 posts)

I got the same problem on a Samsung Galaxy i9000. No texture. Runs fine on both the emulator and on my Samsung Galaxy Note.

I have tried to download the original code example, same problem. I haven’t investigated the problem yet.

08 May 2012, 20:39
Ed Burnette (1341 posts)

The i9000 is the original Galaxy S isn’t it? I tried it on a Vibrant and it worked ok. Let me know if you figure out the cause.

21 Jan 2013, 01:55
Benjamin Guillet (1 post)

I had the exact same issue on a Nexus S and was able to fix it thanks to Gerard Gilliland’s code.