2
votes

I know this is something i should have learned before switching to opengl es 1.0 from software drawing, but I've been unable to find any information on the subject...

My opengl app crashes after going to sleep if nothing is touched for a while... I'm wondering if it's because i'm not unloading textures or vertex/colour/texture/index buffers before it goes to sleep... I'm really unsure on how to do this or even if it would help... could someone direct me to or tell me a quick guide to the rules of what has to be reloaded, destroyed and so on? I'm really confused by all this...

I dunno if it's helpful, but my main class extends GLSurfaceView and implements "Renderer", which loads all the textures and buffer objects in onScreenCreated and fixes the screen scaling on onSurfaceChanged. In the main activity (which is where the main class is linked in) overides onResume and onPause calling the onResume and onPause openGL surface commands...

Any clue to what might be wrong would be very helpful... My game engine is halfway coded but I'm worried that a glitch like this will just halt my current and future projects.

I'm using Froyo (android 2.2) and openGL ES 1.0.

error print out from logcat:

10-24 03:13:41.988: ERROR/AndroidRuntime(9888): FATAL EXCEPTION: GLThread 26

10-24 03:13:41.988: ERROR/AndroidRuntime(9888): java.lang.IllegalThreadStateException: Thread already started.

10-24 03:13:41.988: ERROR/AndroidRuntime(9888): at java.lang.Thread.start(Thread.java:1322)

10-24 03:13:41.988: ERROR/AndroidRuntime(9888): at or.gl.m5.Screen.onSurfaceCreated(Screen.java:161)

10-24 03:13:41.988: ERROR/AndroidRuntime(9888): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1317)

10-24 03:13:41.988: ERROR/AndroidRuntime(9888): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)

1

1 Answers

2
votes

Without seeing a stack trace or what kind of exception it throws out it is kind of hard to say something. But anyway I'm throwing a wild guess that it crashes because you have to reload textures after your activity is resumed. The textures you have previously created become invalid once your view goes to background.