桌面/平台问题的 OpenGL 游戏开发
有人有在 Windows 上编写专业 OpenGL 游戏的经验吗?对于Mac来说,由于苹果的控制,操作系统显得相当“统一”。对于Windows来说,由于硬件不同,安装的驱动程序不同等等......硬件基础似乎有很多很多不同的配置。
理论上,OpenGL 提供了一个 API 来抽象所有这些。在实践中,许多驱动程序经常有错误并且有奇怪的情况 - 这对于在 Windows 上开发游戏来说是一个问题吗?
谢谢!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
两个最大的 GPU 供应商(Nvidia 和 ATI)都提供 OpenGL 3.x 驱动程序,该驱动程序利用了现代硬件的最新功能。正如 Chris 指出的那样,主要问题是用户需要安装供应商自己提供的最新驱动程序,因为 Windows 附带了最基本的 OpenGL 支持(感谢微软,他们似乎竭尽全力削弱 OpenGL 并推动DirectX)。因此,只要他们有最新的驱动程序,就应该没问题。
驱动程序之间不可避免地存在一些(大多数是微小的)差异。例如,我注意到 Nvidia 的 GLSL 编译器比 ATI 的更挑剔,并且拒绝一些本来可以正常工作的着色器代码。最重要的是你需要对两者进行测试(无论如何你都会这样做)。
gDebugger 工具似乎非常擅长追踪性能问题。 (不过,随 Xcode 免费提供的 OpenGL 工具非常棒。)
您需要从 glext.h ="nofollow noreferrer">OpenGL 扩展注册表 并找出您的应用程序的基本要求。如果您可以帮助的话,您可能不希望根据可用的扩展来使用备用代码路径!正如 epatel 提到的,有一些库(例如 GLEW 和 GLEE)可以帮助扩展管理过程。我最终编写了自己的,因为我不喜欢这些实现。
如果您还没有选择工具集,那么有很多 OpenGL 引擎和场景图。
我一路上发现了一些小错误,但几乎所有错误都很容易解决。这些天一切都很好。
The two biggest GPU vendors (Nvidia and ATI) both provide OpenGL 3.x drivers, which take advantage of the latest features of modern hardware. As Chris points out, the main issue is that the user will need to install the latest drivers from the vendors themselves, as Windows ships with the most rudimentary OpenGL support (thanks to Microsoft, who seem to do everything they can to knife OpenGL and push DirectX). So provided they have recent drivers, you should be fine.
There are inevitably some (mostly minor) differences between the drivers. For example, I've noticed Nvidia's GLSL compiler is a little more picky than ATI's, and rejects some shader code that otherwise works fine. Bottom line is you need to test on both (which you would be doing anyway).
The gDebugger tool seems to be pretty good at tracking down performance issues. (The OpenGL tools that ship free with Xcode are pretty awesome though.)
You'll need to get
glext.h
from the OpenGL extensions registry and figure out the base requirements for your app. You probably don't want to have alternate code paths based on which extensions are available, if you can help it! And as epatel mentions, there are a few libraries (such as GLEW and GLEE) which help with the process of extension management. I ended up writing my own, as I didn't like those implementations.There's lots of engines and scene graphs for OpenGL, if you haven't already chosen your toolset.
I've found a few little bugs along the way, but nearly all were easy to work around. These days things are pretty good.
您将面临的最大问题很简单:Windows 7 不附带硬件 OpenGL。如果用户不采取行动将默认视频驱动程序替换为来自供应商站点的更新版本,那么他们拥有的唯一 OpenGL 支持将是 ~v1.0 软件渲染器。
The biggest problem you will face is simply this: Windows 7 does not ship with a hardware OpenGL. If the user does not take the action to replace the default video drivers with updated versions from the vendors site the only OpenGL support they have will be a ~v1.0 software renderer.
我还没有在 Windows 上制作专业的 OpenGL 游戏,但我认为一件重要的事情是查询 OpenGL 驱动程序,了解哪些功能(扩展)可用并处理这些功能。还有一个包可以通过 GLEW 库以独立于平台的方式处理此问题。认为这是了解如何处理不同 OpenGL 功能的良好开端。
I haven't yet made a professional OpenGL game on Windows, but I think one important thing is to query the OpenGL drivers about what capabilities (extensions) are available and handle those functions. There is also a package to handle this in a platform independent way with the GLEW library. Think that is a good start to understand how to handle different OpenGL capabilities.