[英]Android OpenGL app display white screen when launch the second time
My game displays texture correctly in the first launch, then I exit and launch it again and display nothing but white screen. 我的游戏在第一次启动时正确显示纹理,然后退出并再次启动它,只显示白色屏幕。 I think there are some problems with texture loading and android activity life-cycle such as clean up things when pause or destroy.
我认为纹理加载和android活动生命周期存在一些问题,例如在暂停或破坏时清理东西。 The funny thing is it only display white screen when i run it, but display perfectly well when i debug.
有趣的是它在运行时只显示白屏,但是在调试时显示得很好。 Please give me some of your advice, thank you.
请给我您的一些建议,谢谢。
My experience so far: 到目前为止的经验:
You should use the onPause and onResume methods, if its not solving the problem I will add more suggestions. 您应该使用onPause和onResume方法,如果不能解决问题,我会添加更多建议。 I had the same problem a few months ago.
几个月前我遇到了同样的问题。
@Override
protected void onPause() {
super.onPause();
mGLView.onPause();
}
@Override
protected void onResume() {
super.onResume();
mGLView.onResume();
}
Ok then maybe: 好吧,也许吧:
public void onSurfaceChanged(GL10 gl, int w, int h) {
gl.glViewport(0, 0, w, h);
}
Are you reloading the textures in onSurfaceCreated() or in another place? 您是在onSurfaceCreated()还是在其他地方重新加载纹理? You'll want to have that stuff in onSurfaceCreated().
您将需要在onSurfaceCreated()中拥有这些东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.