Context change

Started by Raswr, June 05, 2013, 09:31:42 PM

Previous topic - Next topic

Raswr

So I'm getting a crash on my app after pressing home and going back into it,

06-05 21:23:37.915: E/AndroidRuntime(28038): FATAL EXCEPTION: GLThread 43544
06-05 21:23:37.915: E/AndroidRuntime(28038): java.lang.NullPointerException
06-05 21:23:37.915: E/AndroidRuntime(28038): at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2157)
06-05 21:23:37.915: E/AndroidRuntime(28038): at com.threed.jpct.World.draw(World.java:1344)
06-05 21:23:37.915: E/AndroidRuntime(28038): at com.threed.jpct.World.draw(World.java:1085)


I've been searching but haven't found what I have to do exactly to manage gl context changes. Is the solution to load all the models from the files (serialized) again? and same goes for the textures? I thought the engine would manage re-upload of vbos and textures to the gpu, but now I don't really know, the info is a bit confusing to me.



Thank you.


EgonOlsen

There's actually nothing you have to do manage a context change if you don't want to. The engine should handle it by itself unless you don't remove any textures or meshes. Are you doing anything like that in onPause/onStop/...?

Raswr

Quote from: EgonOlsen on June 05, 2013, 10:35:46 PM
There's actually nothing you have to do manage a context change if you don't want to. The engine should handle it by itself unless you don't remove any textures or meshes. Are you doing anything like that in onPause/onStop/...?

Ok thanks Egon, for some reason I was clearing the texture manager on OnStop() and I got confused while reading some posts about the glcontext that I didn't understand :o, I should have double-checked my code first , problem solved!