OpenGL 还是 DirectX?

2021-12-19 00:00:00 opengl c++ directx

我知道这可能是一个非常主观的问题,但我只想从最容易和最快学习的一个开始,这样我就可以尽快开始我的一个小项目,aa小 2D 游戏,至少从...开始.. 你会推荐我玩哪一个?我正在使用 C++

I know this is probably a very subjective question, but I just want to start with the one which is the easiest and fastest to learn, so that I can get started with a small project of mine as fast as possible, it's a a little 2D game, to start with at least.. Which one would you recommend me to go with? And I'm using C++

推荐答案

第一个问题:您使用的是 Windows 吗?如果没有,请使用 OpenGL.

First question: Are you on Windows? If not, use OpenGL.

如果您使用的是 Windows,这将归结为品味问题.API 不同,但 OpenGL 和 DirectX 所需的概念非常相似.大多数东西都支持,尽管它们的工作方式略有不同.

If you're on Windows, this will come down to a matter of taste. The APIs are different, but the concepts required are very similar for both OpenGL and DirectX. Most things are supported on both, although they do work a bit differently.

Microsoft 提供了相当多的示例和一个可用于 DirectX(9 或 10)的不错的框架,可以使您更容易上手.

Microsoft provides quite a few samples and a decent framework you can use for DirectX (9 or 10), which can make it easier to get started.

话虽如此,如果您只针对 Windows Vista/Win7,迁移到 DirectX 10 可能会让生活更轻松.DX9 及更早版本中的很多烦恼在 DX10 中都被移除了,API 更干净了一些.

That being said, if you're targetting Windows Vista/Win7 only, moving to DirectX 10 may make life easier. A lot of the annoyances in DX9 and earlier were removed in DX10, and the API is a bit more clean.

话虽如此,如果这是用于游戏,我建议您考虑使用像 Ogre 而不是直接在 DirectX 或 OpenGL 中编写.这将使您的生活变得更加简单,尤其是在学习期间.

That being said, if this is for a game, I'd recommend looking at using a middleware engine like Ogre instead of writing directly in DirectX OR OpenGL. This will make your life much simpler, especially while learning.

相关文章