简体   繁体   English

在保留EGL上下文的同时最小化OpenGL应用程序会导致巨大问题

[英]Minmizing OpenGL app while preserving EGL Context results in HUGE PROBLEM

I'm using opengl es 3.0 API with the android studio ndk to create apps. 我正在将opengl es 3.0 API与android studio ndk一起使用来创建应用。 But I've encountered a very huge problem. 但是我遇到了一个非常大的问题。 I've created a demo app, all it does it change the background color of the screen from white to black and vice versa, every frame. 我已经创建了一个演示应用程序,它所做的一切都会在每一帧中将屏幕的背景颜色从白色更改为黑色,反之亦然。 And so when I go to minimize this app, I still see it rendering the background, mostly at the edges of the screen, and not in full color but still very strongly apparent. 因此,当我最小化此应用程序时,我仍然看到它呈现背景,主要是在屏幕的边缘,并且不是全彩色的,但仍然非常明显。 And it doesn't go away when I close the app, when I restart the device, or when I run "kill apps" on it. 当我关闭应用程序,重新启动设备或在其上运行“杀死应用程序”时,它并不会消失。 Only a factory data reset fixes the issue, so it's not easy for me to debug this. 只有恢复出厂设置才能解决此问题,因此调试起来并不容易。

This is the relevant code that I'm using for when the app is minimized and receives the APP_CMD_TERMINATE event: 这是在最小化应用程序并接收APP_CMD_TERMINATE事件时使用的相关代码:

eglMakeCurrent(engine->display,EGL_NO_SURFACE,EGL_NO_SURFACE,EGL_NO_CONTEXT);
eglDestroySurface(engine->display,engine->surface);
engine->display = EGL_NO_DISPLAY;
engine->surface = EGL_NO_SURFACE;

I've error checked that eglDestroySurface() is successful. 我已错误检查eglDestroySurface()是否成功。 And I've put debugging messages in to make sure that the main draw loop is NOT executing when the app is minimized. 并且我已放入调试消息,以确保在最小化应用程序时主绘图循环未执行。 But the problem persists and I don't know what to do about it. 但是问题仍然存在,我不知道该怎么办。 Thanks for any help. 谢谢你的帮助。

UPDATE: well, no one has responded, and I still don't know what to do. 更新:嗯,没有人回应,我仍然不知道该怎么办。 Could it be related to threads? 可能与线程有关吗?

UPDATE: Still can't determine what it is, but for some reason it's messing with the System UI. 更新:仍然无法确定它是什么,但是由于某种原因,它与系统用户界面混乱。 Willing to upload my entire source code somewhere if someone would be willing to go through this with me, as I'd really like to be able to continue working on my game engine. 如果有人愿意与我一起学习,可以将我的整个源代码上传到某个地方,因为我真的很想能够继续使用我的游戏引擎。

Is it the "Strict Mode" developer option on the device settings, perhaps? 可能是设备设置上的“严格模式”开发人员选项吗?

That one flashes the screen if an app is blocking. 如果某个应用被阻止,则该屏幕会闪烁。

It would explain why a factory reset changes behaviour. 它可以解释为什么恢复出厂设置会更改行为。

在此处输入图片说明

The answer is not a solution here. 答案不是这里的解决方案。 The above comment by the user columbo was correct. 用户columbo的上述评论是正确的。 I've demoed switching from black to white at high framerates on 3 different android devices, and also my Linux Desktop, all via the openGL api, and it has exhibited this issue on all the devices. 我已经演示了通过openGL api在3个不同的android设备以及我的Linux桌面上以高帧速率从黑色切换到白色的情况,并且在所有设备上都出现了这个问题。 So what he said must be correct: this is a problem with LCD monitor technology itself. 所以他说的必须正确:这是LCD显示器技术本身的问题。 Interestingly, doing completely random colors does not cause this problem. 有趣的是,进行完全随机的颜色不会导致此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM