全屏模式下的 SDL OpenGL Alt-tab 会产生不可预测的结果
我正在使用 SDL 1.2.14 及其附带的 OpenGL 绑定用 C++ 编写游戏。
但是,如果游戏处于全屏状态并且我按 Alt - Tab 退出然后返回游戏,则结果是不可预测的。游戏逻辑仍然在运行。但是,渲染会停止。我只看到在 Alt-tab 之前绘制的游戏的最后一帧
我确保在收到 SDL_APPACTIVE = 1
事件时重新初始化 OpenGL 上下文并重新加载所有纹理似乎仅适用于一个 Alt - Tab,然后是所有后续的 Alt - 选项卡将停止渲染(我已确保每次都正确处理SDL_APPACTIVE
并相应地设置上下文。)
我猜测SDL会在以下情况下执行某些操作最小化我不知道的应用程序时的引擎盖。
有什么想法吗?
I am writing a game in C++ using SDL 1.2.14 and the OpenGL bindings included with it.
However, if the game is in fullscreen and I Alt - Tab out then back into the game, the results are unpredictable. The game logic still runs. However, rendering stops. I only see the last frame of the game that was drawn before the Alt-tab
I've made sure to re-initialize the OpenGL context and reload all textures when I get an SDL_APPACTIVE = 1
event and that seems to work for only one Alt - Tab, then all subsequent Alt - Tabs will stop rendering (I've made sure SDL_APPACTIVE
is properly being handled each time and setting the context accordingly.)
I'd hazard a guess that SDL does something under the hood when minimizing the application that I'm not aware of.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当全屏应用程序失去焦点时,“减慢”速度是一个很好的做法。有两个原因:
尝试在 APPACTIVE=0 时关闭您使用的所有 GL 资源,并在 APPACTIVE=1 时再次分配它们。如果这解决了,那就是“你的错”。如果无法解决,则属于 SDL(或 GL 或 OS)错误。
编辑:s/SO/OS/g
It's a good pratice to "slow down" your fullscreen application when it looses the focus. Two reasons:
Try shutting down every GL resource you use when APPACTIVE=0 and alloc them again on APPACTIVE=1. If this solves, it was "your fault". If it does not solves, it's SDL (or GL or OS) bug.
EDIT: s/SO/OS/g