开发者

Need example how to recover opengl in native code after new onSurfaceCreated

开发者 https://www.devze.com 2023-01-06 04:29 出处:网络
I am almost done creating a game for android using a port of irrlicht 3d engine to android. All code except a minimal frame work to make the native calls and play sounds is written in C++.

I am almost done creating a game for android using a port of irrlicht 3d engine to android. All code except a minimal frame work to make the native calls and play sounds is written in C++. Even the opengles display is created in c++ code using eglGetDisplay and eglCreateWindowSurface

The problem I need to solve is that when home is pressed then relaunch the game the screen is all white. From other answers I have found that the opengl context is lost then recreated when onSurfaceCreated is called. I thought that I 开发者_Python百科could just reload textures but that seams to work for only some textures. Also the background color is changed which is not a resource. It seams I would have to completely restart the game but this could be really annoying to a user.

the port of quake 3 has notes about this problem be has no solution.

Is there a example anywhere of a game written in native code which correctly handles this situation?


The way I handled the situation is to recreate everything. I made sure that all generated stuff like textures and buffers where deleted before recreating everything as if it happened for the first time.

0

精彩评论

暂无评论...
验证码 换一张
取 消