My first guess would be that you are passing a null buffer to a gl
array method.

What you want to do is:

Activity.onPause() -> pause your logic thread and call
GLSurfaceView.onPause()
Activity.onResume() -> resume your logic thread and call
GLSurfaceView.onResume()
GLSurfaceView.onSurfaceChanged() -> Set "not loaded" to true
GLSurfaceView.onDraw()
if "not loaded" {
  load
  "not loaded" = false
}
draw.

That's how I handle it and I have no issues.  I do some "ready-wait"
sync stuff between the renderer and the logic thread so the game logic
always waits for the renderer to be ready to draw before it starts
doing anything important.  When I say load, I mean load anything that
goes into VRAM.  Textures and Buffer objects are the main things.  I
do my loading in onDraw() so that I can show a progress meter and
because it makes it easy to sync stuff that way.

On Feb 7, 4:54 am, Moritz Post <[email protected]> wrote:
> Hi folks
>
> I am having difficulties with the lifecycle of the opengl context.
> While rendering my scene and the user hits the back button, home
> button or another application opens in front of my application, my app
> is still running in the background.
>
> So when my application comes to the foreground later on (user
> relaunches it or the app that was opened on top of it finishes), my
> application crashes and leaves me nothing but a GL stack trace which i
> can't properly decipher.
>
> For rendering i use the GLSurfaceView and therefore delegate the
> onPause and onResume. The crash happens on the first call to
> glDrawElements(..).
>
> I have tried to reload my resource (geometry/textures etc.) on
> onSurfaceChanged but with or without reloading... The problem
> persists.
>
> This behavior can be observed on all AVD versions of the emulator as
> well as on the G1.
>
> Here is the gl stacktrace i get. Any help would be greatly
> appreciated.
>
> Thanks
> Moritz
>
> 02-07 10:33:26.768: INFO/DEBUG(28): *** *** *** *** *** *** *** ***
> *** *** *** *** *** *** *** ***
> 02-07 10:33:26.778: INFO/DEBUG(28): Build fingerprint: 'generic/
> google_sdk/generic/:2.1/ERD79/22607:eng/test-keys'
> 02-07 10:33:26.778: INFO/DEBUG(28): pid: 403, tid: 410  >>>
> com.comp.app <<<
> 02-07 10:33:26.788: INFO/DEBUG(28): signal 11 (SIGSEGV), fault addr
> 00000000
> 02-07 10:33:26.788: INFO/DEBUG(28):  r0 00001401  r1 0000007e  r2
> 00000000  r3 00001403
> 02-07 10:33:26.788: INFO/DEBUG(28):  r4 0041d6c0  r5 00000000  r6
> 0000007e  r7 0041d6c0
> 02-07 10:33:26.788: INFO/DEBUG(28):  r8 00000000  r9 0000007b  10
> 00000000  fp 00137d10
> 02-07 10:33:26.798: INFO/DEBUG(28):  ip 00000000  sp 46b3bd48  lr
> acc86014  pc acc850a0  cpsr 80000010
> 02-07 10:33:27.368: INFO/DEBUG(28):          #00  pc 000050a0  /system/
> lib/egl/libGLES_android.so
> 02-07 10:33:27.378: INFO/DEBUG(28):          #01  pc 00006010  /system/
> lib/egl/libGLES_android.so
> 02-07 10:33:27.388: INFO/DEBUG(28):          #02  pc 0000f1f4  /system/
> lib/libdvm.so
> 02-07 10:33:27.388: INFO/DEBUG(28): code around pc:
> 02-07 10:33:27.388: INFO/DEBUG(28): acc85090 5affffde e8bd87f0
> e1a05002 e3a0a000
> 02-07 10:33:27.388: INFO/DEBUG(28): acc850a0 e5d51000 e1a00004
> ebffff4a e5d51001
> 02-07 10:33:27.398: INFO/DEBUG(28): acc850b0 e1a06000 e1a00004
> ebffff46 e5d51002
> 02-07 10:33:27.398: INFO/DEBUG(28): code around lr:
> 02-07 10:33:27.408: INFO/DEBUG(28): acc86004 e0845105 e1a02008
> e1a0e00f e595f2c0
> 02-07 10:33:27.408: INFO/DEBUG(28): acc86014 e8bd81f0 e8bd81f0
> e597098c e3a01b01
> 02-07 10:33:27.408: INFO/DEBUG(28): acc86024 e281c008 e150000c
> 1affffe1 eafffff7
> 02-07 10:33:27.418: INFO/DEBUG(28): stack:
> 02-07 10:33:27.418: INFO/DEBUG(28):     46b3bd08  3f800000
> 02-07 10:33:27.418: INFO/DEBUG(28):     46b3bd0c  00000000
> 02-07 10:33:27.418: INFO/DEBUG(28):     46b3bd10  40600000
> 02-07 10:33:27.428: INFO/DEBUG(28):     46b3bd14  3fc00000
> 02-07 10:33:27.428: INFO/DEBUG(28):     46b3bd18  41a00000  /dev/
> ashmem/dalvik-LinearAlloc (deleted)
> 02-07 10:33:27.428: INFO/DEBUG(28):     46b3bd1c  3f800000
> 02-07 10:33:27.438: INFO/DEBUG(28):     46b3bd20  000000af
> 02-07 10:33:27.448: INFO/DEBUG(28):     46b3bd24  acf08c14  /system/
> lib/libpixelflinger.so
> 02-07 10:33:27.448: INFO/DEBUG(28):     46b3bd28  0041d6c0  [heap]
> 02-07 10:33:27.448: INFO/DEBUG(28):     46b3bd2c  acf091ac  /system/
> lib/libpixelflinger.so
> 02-07 10:33:27.458: INFO/DEBUG(28):     46b3bd30  0041d6c0  [heap]
> 02-07 10:33:27.458: INFO/DEBUG(28):     46b3bd34  acc9b850  /system/
> lib/egl/libGLES_android.so
> 02-07 10:33:27.458: INFO/DEBUG(28):     46b3bd38  00001100
> 02-07 10:33:27.468: INFO/DEBUG(28):     46b3bd3c  acc9540b  /system/
> lib/egl/libGLES_android.so
> 02-07 10:33:27.468: INFO/DEBUG(28):     46b3bd40  df002777
> 02-07 10:33:27.468: INFO/DEBUG(28):     46b3bd44  e3a070ad
> 02-07 10:33:27.468: INFO/DEBUG(28): #00 46b3bd48  acc9b008  /system/
> lib/egl/libGLES_android.so
> 02-07 10:33:27.468: INFO/DEBUG(28):     46b3bd4c  acc9b018  /system/
> lib/egl/libGLES_android.so
> 02-07 10:33:27.468: INFO/DEBUG(28):     46b3bd50  0000007e
> 02-07 10:33:27.468: INFO/DEBUG(28):     46b3bd54  0041d6c0  [heap]
> 02-07 10:33:27.468: INFO/DEBUG(28):     46b3bd58  00000000
> 02-07 10:33:27.468: INFO/DEBUG(28):     46b3bd5c  42f28e48
> 02-07 10:33:27.468: INFO/DEBUG(28):     46b3bd60  42f28e30
> 02-07 10:33:27.478: INFO/DEBUG(28):     46b3bd64  acc86014  /system/
> lib/egl/libGLES_android.so
> 02-07 10:33:27.478: INFO/DEBUG(28): #01 46b3bd68  46b3bda8
> 02-07 10:33:27.478: INFO/DEBUG(28):     46b3bd6c  00000000
> 02-07 10:33:27.478: INFO/DEBUG(28):     46b3bd70  42aadedc  /data/
> dalvik-cache/sys...@framew...@[email protected]
> 02-07 10:33:27.488: INFO/DEBUG(28):     46b3bd74  42f28e58
> 02-07 10:33:27.488: INFO/DEBUG(28):     46b3bd78  46b3bd88
> 02-07 10:33:27.488: INFO/DEBUG(28):     46b3bd7c  ad00f1f8  /system/
> lib/libdvm.so
> 02-07 10:33:28.908: DEBUG/Zygote(30): Process 403 terminated by signal
> (11)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to