使用 SDL 在 MacOS X 上全屏显示时 OpenGL 速度变慢?
我一直在使用最新的 SDL 1.3 和 OpenGL 来开发一款游戏,目前正在进行 beta 测试。一些用户报告称,在窗口模式下可以轻松运行 200-300 fps 的程序上,全屏显示时速度会大幅下降(大约 18 fps)。这些用户通常能够通过在窗口模式和全屏模式之间切换一两次来“解决”问题。然后它会全速运行,甚至全屏运行。
我无法在我测试的任何系统上复制它。遇到速度变慢的三个用户都在运行不同显卡的一系列不同系统(全部都是 Intel 双核 2 系统)上,所以我怀疑这是驱动程序问题。
令人鼓舞的是,即使在 SDL 附带的 SDL 非常小的 testgl2 演示中也演示了该问题。如果您只是将演示修改为全屏运行,那么只要它在“受影响的”系统之一上运行,它就会在全屏时表现出相同的速度减慢。我很好奇这里是否有人拥有重复该问题的 MacOS X 系统。要查看,只需下载最新的 SDL 1.3:
http://www.libsdl.org/tmp /SDL-1.3.zip
并构建 SDL 框架,然后构建 SDL 测试,编译 gltest2 演示。打开 gltest2.c 并输入:
SDL_SetWindowFullscreen( state->windows[0], true );
就在 /* 主渲染循环 */ 之前
如果您可以在系统上重复该问题 [即全屏时运行速度低于 60fps - 退出时检查控制台输出的帧速率],请在此处发布。特别是如果您认为您可能有解决问题的想法!几周来我一直在尝试解决这个问题,但在互联网上搜索却无济于事。
I've been using the latest SDL 1.3 with OpenGL to develop a game that is now in beta testing. Some users are reporting massive slowdowns when fullscreen -- about 18fps -- on something that can easily run 200-300fps in windowed mode. These same users are usually able to "fix" the problem by toggling between windowed and fullscreen modes once or twice. It then runs full-speed for them even fullscreen.
I'm unable to duplicate it on any of the systems I test on. And the three users who are experiencing the slowdown are on a range of different systems (all do happen to be Intel Dual Core 2 systems) running different graphics cards, so I doubt it's a driver issue.
What's encouraging is that the problem is demonstrated even in SDL's very minimal testgl2 demo that comes with SDL. If you simply modify the demo to run fullscreen, it'll demonstrate the same slowdown when fullscreen, as long as it's run on one of the "affected" systems. I'm curious if anyone here has MacOS X systems that duplicate the problem. To see, just download the latest SDL 1.3:
http://www.libsdl.org/tmp/SDL-1.3.zip
and build the SDL framework and then the SDL Test, compiling the gltest2 demo. Open up gltest2.c and put:
SDL_SetWindowFullscreen( state->windows[0], true );
right before /* Main render loop */
If you CAN duplicate the problem on your system [i.e. it runs under 60fps when fullscreen -- check your console output for the frame rate when you quit), please post here. Especially if you think you might have ideas for how to fix it! I've been trying to fix this for a couple of weeks now, and have scoured the internet to no avail.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,这是 SDL 1.3 中的一个错误(使当前全屏 OpenGL 上下文再次成为当前上下文很慢,因此现在 SDL 缓存当前上下文以使 SDL_GL_MakeCurrent() 成为无操作)。现在已在变更集 2a152e7e82f2 和 7ed38a8ad304 之间修复。
This turned out to be a bug in SDL 1.3 (making the current fullscreen OpenGL context current again was slow, so now SDL caches the current context to make SDL_GL_MakeCurrent() a no-op). It's fixed now, between changesets 2a152e7e82f2 and 7ed38a8ad304.