Gustavo Maciel
Gustavo Maciel

Reputation: 652

glDrawElements crashing on devices, working well on emulator

I've been spending my time with OpenGL-ES over android. Everything goes well, I'm making a 2D game, I can display sprites on the screen, move them, etc etc. But all that just works on the emulator. On my Motorola Droid 1, it just close (even without the forceclose warning).

The debugger did not throws anything, nor send debug text, so I stopped at some lines and gone with step into and step over until reach the place that the app suddenly closes.

The result is, it closes in this line:

gl.glDrawElements(GL10.GL_TRIANGLES, 6, GL10.GL_UNSIGNED_SHORT, indices);

To help, this is my full drawing function:

    /**
 * Draw the sprite on the screen
 * @param gl OpenGLES Context
 */
public void draw(GL10 gl, Vector3 position){
    if(textured)
        gl.glBindTexture(GL10.GL_TEXTURE_2D, textureName);

    gl.glPushMatrix();
        gl.glLoadIdentity();
        gl.glTranslatef(position.X, position.Y, position.Z);
        gl.glScalef(scale.X, scale.Y, 1);
        gl.glRotatef(rotation.X, 1.0f, 0.f, 0.0f);
        gl.glRotatef(rotation.Y, 0.0f, 1.0f, 0.0f);
        gl.glRotatef(rotation.Z, 0.0f, 0.0f, 1.0f);

        gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertices);

        if(textured)
            gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, uvs);

        //gl.glColorPointer(4, GL10.GL_FLOAT, 0, colors);

        gl.glDrawElements(GL10.GL_TRIANGLES, 6, GL10.GL_UNSIGNED_SHORT, indices);
    gl.glPopMatrix();
}

I have no clues about what makes this, because it works very well, display my sprites and so on the emulator, but closes on the device.

Here's the logcat log:

12-20 01:28:29.615: D/AndroidRuntime(3103): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
12-20 01:28:29.615: I/AndroidRuntime(3103): Heap size: -Xmx24m
12-20 01:28:29.615: D/AndroidRuntime(3103): CheckJNI is OFF
12-20 01:28:29.615: D/dalvikvm(3103): creating instr width table
12-20 01:28:29.787: D/AndroidRuntime(3103): Calling main entry com.android.commands.pm.Pm
12-20 01:28:29.795: D/AndroidRuntime(3103): Shutting down VM
12-20 01:28:29.803: D/dalvikvm(3103): GC_CONCURRENT freed 101K, 71% free 306K/1024K, external 0K/0K, paused 1ms+0ms
12-20 01:28:29.803: I/AndroidRuntime(3103): NOTE: attach of thread 'Binder Thread #3' failed
12-20 01:28:29.803: D/jdwp(3103): Got wake-up signal, bailing out of select
12-20 01:28:29.803: D/dalvikvm(3103): Debugger has detached; object registry had 1 entries
12-20 01:28:30.194: D/AndroidRuntime(3113): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
12-20 01:28:30.194: I/AndroidRuntime(3113): Heap size: -Xmx24m
12-20 01:28:30.194: D/AndroidRuntime(3113): CheckJNI is OFF
12-20 01:28:30.194: D/dalvikvm(3113): creating instr width table
12-20 01:28:30.365: D/AndroidRuntime(3113): Calling main entry com.android.commands.am.Am
12-20 01:28:30.381: I/ActivityManager(2047): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.cygnus.shootaray/.ShotaRayActivity } from pid 3113
12-20 01:28:30.405: D/AndroidRuntime(3113): Shutting down VM
12-20 01:28:30.405: D/dalvikvm(3113): GC_CONCURRENT freed 103K, 69% free 324K/1024K, external 0K/0K, paused 0ms+0ms
12-20 01:28:30.405: E/dalvikvm(3121): could not disable core file generation for pid 3121: Operation not permitted
12-20 01:28:30.405: I/ActivityManager(2047): Start proc com.cygnus.shootaray for activity com.cygnus.shootaray/.ShotaRayActivity: pid=3121 uid=10066 gids={}
12-20 01:28:30.412: I/AndroidRuntime(3113): NOTE: attach of thread 'Binder Thread #3' failed
12-20 01:28:30.412: D/jdwp(3113): Got wake-up signal, bailing out of select
12-20 01:28:30.412: D/dalvikvm(3113): Debugger has detached; object registry had 1 entries
12-20 01:28:30.498: D/szipinf(3121): Initializing inflate state
12-20 01:28:30.631: D/libEGL(3121): loaded /system/lib/egl/libEGL_POWERVR_SGX530_121.so
12-20 01:28:30.631: D/libEGL(3121): loaded /system/lib/egl/libGLESv1_CM_POWERVR_SGX530_121.so
12-20 01:28:30.647: D/libEGL(3121): loaded /system/lib/egl/libGLESv2_POWERVR_SGX530_121.so
12-20 01:28:30.811: I/ActivityManager(2047): Displayed com.cygnus.shootaray/.ShotaRayActivity: +413ms
12-20 01:28:30.842: D/dalvikvm(3121): GC_EXTERNAL_ALLOC freed 58K, 50% free 2702K/5379K, external 0K/0K, paused 54ms
12-20 01:28:30.952: I/DEBUG(1456): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-20 01:28:30.959: I/DEBUG(1456): Build fingerprint: 'MOTO_RTEU/umts_sholes/umts_sholes/sholes:2.2.1/SHOLS_U2_05.26.3/296482885:user/release-keys'
12-20 01:28:30.959: I/DEBUG(1456): pid: 3121, tid: 3130  >>> com.cygnus.shootaray <<<
12-20 01:28:30.959: I/DEBUG(1456): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
12-20 01:28:30.959: I/DEBUG(1456):  r0 44d2e0c0  r1 00000000  r2 00000000  r3 00000000
12-20 01:28:30.959: I/DEBUG(1456):  r4 00154e20  r5 00155c80  r6 00000001  r7 00000004
12-20 01:28:30.959: I/DEBUG(1456):  r8 00000024  r9 00000000  10 00000004  fp 00000000
12-20 01:28:30.959: I/DEBUG(1456):  ip 8096a63c  sp 442eba90  lr 80906a44  pc afd0d078  cpsr 60000010
12-20 01:28:30.959: I/DEBUG(1456):  d0  6472656767756265  d1  0000000043000000
12-20 01:28:30.959: I/DEBUG(1456):  d2  0000000000000000  d3  4300000000000000
12-20 01:28:30.959: I/DEBUG(1456):  d4  0000000000000000  d5  0000000000000000
12-20 01:28:30.959: I/DEBUG(1456):  d6  0000000000166b40  d7  0000000000000000
12-20 01:28:30.959: I/DEBUG(1456):  d8  0000000000204762  d9  0000000000000000
12-20 01:28:30.959: I/DEBUG(1456):  d10 0000000000000000  d11 0000000000000000
12-20 01:28:30.959: I/DEBUG(1456):  d12 0000000000000000  d13 0000000000000000
12-20 01:28:30.959: I/DEBUG(1456):  d14 0000000000000000  d15 0000000000000000
12-20 01:28:30.967: I/DEBUG(1456):  d16 41df86f6ff34fdf4  d17 3f50624dd2f1a9fc
12-20 01:28:30.967: I/DEBUG(1456):  d18 41c6803ace000000  d19 00000000000000ff
12-20 01:28:30.967: I/DEBUG(1456):  d20 000000000000ff00  d21 0000010000000000
12-20 01:28:30.967: I/DEBUG(1456):  d22 000000000000d516  d23 00000001000002fd
12-20 01:28:30.967: I/DEBUG(1456):  d24 0000000000002645  d25 0000000000000000
12-20 01:28:30.967: I/DEBUG(1456):  d26 0000000000002645  d27 0000000000000000
12-20 01:28:30.967: I/DEBUG(1456):  d28 0000000000002645  d29 0000000000000000
12-20 01:28:30.967: I/DEBUG(1456):  d30 0000000000000000  d31 0000000000000000
12-20 01:28:30.967: I/DEBUG(1456):  scr 20000010
12-20 01:28:31.100: I/DEBUG(1456):          #00  pc 0000d078  /system/lib/libc.so
12-20 01:28:31.100: I/DEBUG(1456):          #01  lr 80906a44  /system/lib/egl/libGLESv1_CM_POWERVR_SGX530_121.so
12-20 01:28:31.100: I/DEBUG(1456): code around pc:
12-20 01:28:31.100: I/DEBUG(1456): afd0d058 f400071d f5d1f000 f5d1f040 e2522040 
12-20 01:28:31.100: I/DEBUG(1456): afd0d068 3a000009 f5d1f080 f5d1f0c0 f5d1f100 
12-20 01:28:31.100: I/DEBUG(1456): afd0d078 f421020d f421420d f5d1f100 e2522040 
12-20 01:28:31.100: I/DEBUG(1456): afd0d088 f400022d f400422d 2afffff8 e2822040 
12-20 01:28:31.100: I/DEBUG(1456): afd0d098 e2522020 3a000003 f421020d e2522020 
12-20 01:28:31.100: I/DEBUG(1456): code around lr:
12-20 01:28:31.100: I/DEBUG(1456): 80906a24 e3530000 1a000005 e1a03007 e59c0028 
12-20 01:28:31.100: I/DEBUG(1456): 80906a34 e59c102c e59c2024 e1a0e00f e59cf034 
12-20 01:28:31.100: I/DEBUG(1456): 80906a44 e2866001 e2855004 e5942eb0 e3a03001 
12-20 01:28:31.100: I/DEBUG(1456): 80906a54 e1560002 3affffec e2840d77 e1a01008 
12-20 01:28:31.100: I/DEBUG(1456): 80906a64 e2800004 e1a02003 e8bd41f0 ea00cdd5 
12-20 01:28:31.100: I/DEBUG(1456): stack:
12-20 01:28:31.100: I/DEBUG(1456):     442eba50  00000000  
12-20 01:28:31.100: I/DEBUG(1456):     442eba54  00000000  
12-20 01:28:31.100: I/DEBUG(1456):     442eba58  00000000  
12-20 01:28:31.100: I/DEBUG(1456):     442eba5c  00000000  
12-20 01:28:31.100: I/DEBUG(1456):     442eba60  00000000  
12-20 01:28:31.108: I/DEBUG(1456):     442eba64  00000000  
12-20 01:28:31.108: I/DEBUG(1456):     442eba68  00000001  
12-20 01:28:31.108: I/DEBUG(1456):     442eba6c  00000000  
12-20 01:28:31.108: I/DEBUG(1456):     442eba70  00000000  
12-20 01:28:31.108: I/DEBUG(1456):     442eba74  00154e20  
12-20 01:28:31.108: I/DEBUG(1456):     442eba78  00155c7c  
12-20 01:28:31.108: I/DEBUG(1456):     442eba7c  00000000  
12-20 01:28:31.108: I/DEBUG(1456):     442eba80  00000004  
12-20 01:28:31.108: I/DEBUG(1456):     442eba84  00000024  
12-20 01:28:31.108: I/DEBUG(1456):     442eba88  df002777  
12-20 01:28:31.108: I/DEBUG(1456):     442eba8c  e3a070ad  
12-20 01:28:31.108: I/DEBUG(1456): #00 442eba90  44d2e0c0  
12-20 01:28:31.108: I/DEBUG(1456):     442eba94  80906a44  /system/lib/egl/libGLESv1_CM_POWERVR_SGX530_121.so
12-20 01:28:31.108: I/DEBUG(1456):     442eba98  00154e20  
12-20 01:28:31.108: I/DEBUG(1456):     442eba9c  00000004  
12-20 01:28:31.108: I/DEBUG(1456):     442ebaa0  000a49c8  
12-20 01:28:31.108: I/DEBUG(1456):     442ebaa4  00000006  
12-20 01:28:31.108: I/DEBUG(1456):     442ebaa8  8096a5e4  
12-20 01:28:31.108: I/DEBUG(1456):     442ebaac  8090813c  /system/lib/egl/libGLESv1_CM_POWERVR_SGX530_121.so
12-20 01:28:31.108: I/DEBUG(1456):     442ebab0  000a3248  
12-20 01:28:31.108: I/DEBUG(1456):     442ebab4  00163500  
12-20 01:28:31.108: I/DEBUG(1456):     442ebab8  00000000  
12-20 01:28:31.108: I/DEBUG(1456):     442ebabc  00000006  
12-20 01:28:31.108: I/DEBUG(1456):     442ebac0  44f5c420  
12-20 01:28:31.108: I/DEBUG(1456):     442ebac4  00154e20  
12-20 01:28:31.108: I/DEBUG(1456):     442ebac8  00000004  
12-20 01:28:31.108: I/DEBUG(1456):     442ebacc  8096a5e4  
12-20 01:28:31.108: I/DEBUG(1456):     442ebad0  00000006  
12-20 01:28:31.108: I/DEBUG(1456):     442ebad4  00000004  
12-20 01:28:32.162: I/BootReceiver(2047): Copying /data/tombstones/tombstone_08 to DropBox (SYSTEM_TOMBSTONE)
12-20 01:28:32.178: E/InputDispatcher(2047): channel '407c49d0 com.cygnus.shootaray/com.cygnus.shootaray.ShotaRayActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
12-20 01:28:32.178: E/InputDispatcher(2047): channel '407c49d0 com.cygnus.shootaray/com.cygnus.shootaray.ShotaRayActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
12-20 01:28:32.186: D/Zygote(1469): Process 3121 terminated by signal (11)
12-20 01:28:32.225: D/dalvikvm(2047): GC_FOR_MALLOC freed 390K, 43% free 5438K/9415K, external 1601K/4601K, paused 59ms
12-20 01:28:32.225: I/WindowManager(2047): WIN DEATH: Window{407c49d0 com.cygnus.shootaray/com.cygnus.shootaray.ShotaRayActivity paused=false}
12-20 01:28:32.225: I/ActivityManager(2047): Process com.cygnus.shootaray (pid 3121) has died.
12-20 01:28:32.241: I/WindowManager(2047): WIN DEATH: Window{407dd460 SurfaceView paused=false}
12-20 01:28:32.303: D/dalvikvm(2047): GC_FOR_MALLOC freed 317K, 42% free 5505K/9415K, external 1601K/4601K, paused 43ms
12-20 01:28:32.342: W/InputManagerService(2047): Got RemoteException sending setActive(false) notification to pid 3121 uid 10066

Any hints, please?

EDIT:

As mentioned by Spoon Thumb, here are my enable/disable calls:

gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);

gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

for (Drawable i : toDraw) {
    i.draw(gl);
}

gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

these are on the onDrawFrame. it calls the drawable.draw, that are the first function i have posted.

If it would help, this is my onSurfaceChanged with my enables and disables:

public void onSurfaceChanged(GL10 gl, int width, int height) {
gl.glViewport(0, 0, width, height);
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrthof(0.0f, width, 0.0f, height, 0.0f, 1.0f);

gl.glShadeModel(GL10.GL_FLAT);
gl.glEnable(GL10.GL_BLEND);
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
}

ALSO, i have edited the code a little, dont have sure about i changed, but now i dont receive a SIGSEGV 11, the code runs on my device, but i cant see nothing.

Upvotes: 2

Views: 4241

Answers (3)

Gustavo Maciel
Gustavo Maciel

Reputation: 652

I managed to make this work by myself.

I don't know EXACTLY what I did, but it stopped crashing when:

  • Changed glDrawElements to glDrawArray

Well, to make this I had to change all the way that I built my quads, and now, I don't use indices anymore (though I should be using).

Changed:

gl.glDrawElements(GL10.GL_TRIANGLES, 6, GL10.GL_UNSIGNED_SHORT, indices);

to:

gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);

Don't forget to point your vertices array.

  • Enable and disable Clientstates for every draw, not once per frame.

Instead of:

gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

drawspriteone();
drawspritetwo();
drawspriteN();...

gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

I had to do this INSIDE of the draw function, like this:

gl.glBindTexture(GL10.GL_TEXTURE_2D, texture.id);

gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertices);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, uvs);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4);

gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
  • Ah, try enabling and disabling textures inside of each draw too.


I don't know which of these changes made the app work on my phone, but it even though now it was running, it still wouldn't draw anything. Yes, I could see the buffer clear color, but no textures.

What did I do?

Well, it was a lot of trial and error, some research lead me to think that the GPU of Milestones (it's the European/South American version of Moto Droid) and some other devices has a OpenGL driver that works quite different, and they don't support changing the color format. Maybe that can be true, but it wasn't the case.

I changed the orders of the calls, set states, etc. But my error was so, so, so silly, that I could find it just today.

Let's cut to the answer:

DRAW 2D QUADS ON THE 0.0f Z COORD!

Why? I don't know. But, my Z coord of every sprite was set to 0.1f, I changed them and now I can see all the sprites. Strange huh? Even stranger: the emulator COULD see the textures with the z set to 0.1f, but the device didn't..

Just to let you know, this was my viewport setting:

gl.glOrthof(0.0f, width, 0.0f, height, 0.0f, 1.0f);

nearplane as 0.0f and farplane as 1.0f. Shouldn't it accept values between 0.0f and 1.0f?

Thanks! that's the final answer to my question (:

Upvotes: 2

sven
sven

Reputation: 229

My program crashed while use gl.glDrawElements().

I find the reason is the code:

byteBuffer = ByteBuffer.allocate(6 * 2);

The work well one:

byteBuffer = ByteBuffer.allocateDirect(6 * 2);
byteBuffer.order(ByteOrder.nativeOrder()); 
indices = byteBuffer.asShortBuffer();
indices.put(new short[]{2, 0, 1, 1, 3, 2}); 
indices.flip();

Here's the error logcat log:

12-02 23:21:27.210: I/DEBUG(7052): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-02 23:21:27.210: I/DEBUG(7052): Build fingerprint: 'MOTO/MB525_RTNORD/umts_jordan/jordan:2.2.2/3.4.2-177/1302080923:user/release-keys'
12-02 23:21:27.210: I/DEBUG(7052): pid: 7016, tid: 7045  >>> com.player.opengles <<<
12-02 23:21:27.210: I/DEBUG(7052): signal 11 (SIGSEGV), fault addr 00000000
12-02 23:21:27.210: I/DEBUG(7052):  r0 00000000  r1 00000002  r2 00001403  r3 00000006
12-02 23:21:27.210: I/DEBUG(7052):  r4 00294bd0  r5 00000004  r6 8156b5fc  r7 00000006
12-02 23:21:27.217: I/DEBUG(7052):  r8 4818bb78  r9 00001403  10 00000000  fp 00000000
12-02 23:21:27.217: I/DEBUG(7052):  ip 00000000  sp 4818baf8  lr 00000000  pc 81509394  cpsr 60000050
12-02 23:21:27.217: I/DEBUG(7052):  d0  6472656767756265  d1  0000000000110e78
12-02 23:21:27.217: I/DEBUG(7052):  d2  0000000000000000  d3  0000000000000000
12-02 23:21:27.217: I/DEBUG(7052):  d4  0000000000000000  d5  0000000000000000
12-02 23:21:27.217: I/DEBUG(7052):  d6  0000000000000000  d7  0000000000000000
12-02 23:21:27.217: I/DEBUG(7052):  d8  0000000019618ddf  d9  0000000000000000
12-02 23:21:27.217: I/DEBUG(7052):  d10 0000000000000000  d11 0000000000000000
12-02 23:21:27.217: I/DEBUG(7052):  d12 0000000000000000  d13 0000000000000000
12-02 23:21:27.217: I/DEBUG(7052):  d14 0000000000000000  d15 0000000000000000
12-02 23:21:27.217: I/DEBUG(7052):  d16 41c28ee0e720a3d7  d17 3f50624dd2f1a9fc
12-02 23:21:27.217: I/DEBUG(7052):  d18 41bbfb4daf000000  d19 0000000000000000
12-02 23:21:27.217: I/DEBUG(7052):  d20 3ff0000000000000  d21 8000000000000000
12-02 23:21:27.217: I/DEBUG(7052):  d22 0000000000000000  d23 0000000000000000
12-02 23:21:27.217: I/DEBUG(7052):  d24 0000000000000000  d25 3ff0000000000000
12-02 23:21:27.217: I/DEBUG(7052):  d26 0000000000000000  d27 0000000000000000
12-02 23:21:27.217: I/DEBUG(7052):  d28 0020002000200020  d29 3ff0000000000000
12-02 23:21:27.217: I/DEBUG(7052):  d30 0000000000000000  d31 3ff0000000000000
12-02 23:21:27.217: I/DEBUG(7052):  scr 20000012
12-02 23:21:27.233: D/dalvikvm(7039): GC_FOR_MALLOC freed 550 objects / 327560 bytes in 83ms
12-02 23:21:27.272: I/DEBUG(7052):          #00  pc 00009394  /system/lib/egl/libGLESv1_CM_POWERVR_SGX530_125.so
12-02 23:21:27.280: I/DEBUG(7052):          #01  lr 00000000  <unknown>
12-02 23:21:27.280: I/DEBUG(7052): code around pc:
12-02 23:21:27.280: I/DEBUG(7052): 81509374 e1510008 31a01008 e1520008 21a02008 
12-02 23:21:27.280: I/DEBUG(7052): 81509384 e2800001 e15b0000 8afffff7 ea00000c 
12-02 23:21:27.280: I/DEBUG(7052): 81509394 e1db20b0 e1a0000b e08bb087 e1a01002 
12-02 23:21:27.280: I/DEBUG(7052): 815093a4 ea000004 e1d080b0 e1510008 31a01008 
12-02 23:21:27.280: I/DEBUG(7052): 815093b4 e1520008 21a02008 e2800002 e15b0000 
12-02 23:21:27.280: I/DEBUG(7052): code around lr:
12-02 23:21:27.288: I/DEBUG(7052): stack:
12-02 23:21:27.288: I/DEBUG(7052):     4818bab8  002956a8  [heap]
12-02 23:21:27.288: I/DEBUG(7052):     4818babc  000001fc  
12-02 23:21:27.288: I/DEBUG(7052):     4818bac0  4818bb30  
12-02 23:21:27.288: I/DEBUG(7052):     4818bac4  00000001  
12-02 23:21:27.288: I/DEBUG(7052):     4818bac8  00000001  
12-02 23:21:27.288: I/DEBUG(7052):     4818bacc  00000001  
12-02 23:21:27.288: I/DEBUG(7052):     4818bad0  0028a680  [heap]
12-02 23:21:27.288: I/DEBUG(7052):     4818bad4  00294bd0  [heap]
12-02 23:21:27.288: I/DEBUG(7052):     4818bad8  00000004  
12-02 23:21:27.288: I/DEBUG(7052):     4818badc  8156b5fc  /system/lib/egl/libGLESv1_CM_POWERVR_SGX530_125.so
12-02 23:21:27.288: I/DEBUG(7052):     4818bae0  00000006  
12-02 23:21:27.288: I/DEBUG(7052):     4818bae4  4818bb78  
12-02 23:21:27.288: I/DEBUG(7052):     4818bae8  00001403  
12-02 23:21:27.288: I/DEBUG(7052):     4818baec  00000000  
12-02 23:21:27.288: I/DEBUG(7052):     4818baf0  df002777  
12-02 23:21:27.288: I/DEBUG(7052):     4818baf4  e3a070ad  
12-02 23:21:27.296: I/DEBUG(7052): #00 4818baf8  00000000  
12-02 23:21:27.296: I/DEBUG(7052):     4818bafc  43428ec8  
12-02 23:21:27.296: I/DEBUG(7052):     4818bb00  00000000  
12-02 23:21:27.296: I/DEBUG(7052):     4818bb04  0028a680  [heap]
12-02 23:21:27.296: I/DEBUG(7052):     4818bb08  ad382d20  /system/lib/libandroid_runtime.so
12-02 23:21:27.296: I/DEBUG(7052):     4818bb0c  45b5d0c0  /dev/ashmem/mspace/dalvik-heap/2 (deleted)
12-02 23:21:27.296: I/DEBUG(7052):     4818bb10  00000000  
12-02 23:21:27.296: I/DEBUG(7052):     4818bb14  00000000  
12-02 23:21:27.296: I/DEBUG(7052):     4818bb18  41e8e960  /dev/ashmem/dalvik-LinearAlloc (deleted)
12-02 23:21:27.296: I/DEBUG(7052):     4818bb1c  00000006  
12-02 23:21:27.296: I/DEBUG(7052):     4818bb20  0028a680  [heap]
12-02 23:21:27.296: I/DEBUG(7052):     4818bb24  00000000  
12-02 23:21:27.296: I/DEBUG(7052):     4818bb28  41eccfbc  /dev/ashmem/dalvik-LinearAlloc (deleted)
12-02 23:21:27.296: I/DEBUG(7052):     4818bb2c  0028a680  [heap]
12-02 23:21:27.296: I/DEBUG(7052):     4818bb30  00000006  
12-02 23:21:27.296: I/DEBUG(7052):     4818bb34  00000000  
12-02 23:21:27.296: I/DEBUG(7052):     4818bb38  00000004  
12-02 23:21:27.296: I/DEBUG(7052):     4818bb3c  4818bb78  

Upvotes: 1

James Coote
James Coote

Reputation: 1973

You haven't got any enable/disable calls. Try adding at the top of your onDraw method:

    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);


    if(textured){
        gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
    }

and then after glDrawElements():

    if(textured){       
        gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
    }

    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);

failing that, try putting a try/catch block around the glDrawElements() line and/or turn on debugging in your GLSurfaceView:

Upvotes: 1

Related Questions