OpenGL or Direct3D for a new Windows game project?

2019-03-25 14:54发布

I'm starting a hobby game project on Windows that will make heavy use of 3D graphics effects. It will most likely be written in C++.

Should I use OpenGL or Direct3D for my graphics backend? Why?

Or should I use a ready-made graphics engine such as OGRE 3D? Which one?

Some "how to get started" links would be useful. (On either technology, or both.)

Edit - Yes I really meant Direct3D, not DirectX, thanks to graham.reeds for clarification

Edit - Mihai Lazar pointed out that I could also use a graphics engine such OGRE 3D. Edited the question to reflect this alternative.

20条回答
一夜七次
2楼-- · 2019-03-25 15:31

For the situation that you describe, I would recommend Direct3D.

The primary reason to use Direct3D instead of OpenGL is that often video card vendors only do a good job on the OpenGL drivers for their "high end" cards.

The low end game type cards tend to get poor and generally buggy drivers, causing problems on your end user's machines.

If portability is important, then that would be a big reason to look at OpenGL or Ogre instead.

But if you never plan to port, then focus on Direct3D since it is a more widely stable platform with better IHV driver support.

查看更多
祖国的老花朵
3楼-- · 2019-03-25 15:31

To start with, we've got the Wikipedia comparison of OpenGL and Direct3D.

But I'd really like to hear some practical viewpoints, especially in the light of recent developments of OpenGL 3.0 and DirectX 10.

查看更多
虎瘦雄心在
4楼-- · 2019-03-25 15:32

Ogre3D is great if you want to do cross platform coding and if you want to leave all the rendering to the engine. OpenGL is also great for cross platform coding, but it also makes you do all the boring parts -- however it provides greater control.

I would avoid DirectX in case you want to port your game to other platforms. Plan for the future. DirectX 10 may provide some advantages compared to OpenGL, but I really don't think you'll feel them unless you're a professional development. Otherwise, if you're pro-Microsoft, you should use XNA anyway, since as an amateur developer you won't need control provided by DirectX.

I'm coding with OpenGL for quite some time now and with Ogre3D for a few months now and I can't say I want anything else. I recently got a book on DirectX 7 and I consider it messy. Perhaps things changed, but from what I observed I don't find DirectX, and by extrapolation Direct3D, attractive.

查看更多
做个烂人
5楼-- · 2019-03-25 15:33

The thing you should consider is the decision of platform independence. Do you want to tie your game to Windows, or would you like to release it to Mac OS X or Linux at some point. If you decide that you want to support Linux, OS X in the future, you will need to use OpenGL.

There seems to be a lot of goodwill by the Linux community if the game is at least semi-released for Linux.

查看更多
迷人小祖宗
6楼-- · 2019-03-25 15:34

I really agree with those telling you to learn Ogre3D. You said you'd use C++, so Ogre3D is a great choice. XNA uses C# and you'd have to learn the differences between it and C++, apart from learning the very XNA. Also XNA is neither Open Source nor cross platform, so if you wanna have a wider knowledge about game development, I'd suggest first learning SDL, and then Ogre3D.

查看更多
你好瞎i
7楼-- · 2019-03-25 15:37

If you're willing to consider C#, take a good look at XNA. For hobby projects, assuming what you want is to actually get a game up and running instead of tinkering with complex API code, I cannot recommend it highly enough. It is increasingly mature, well-documented, and, compared to D3D/OpenGL, very quick and easy to use. As a bonus, with a $100/year Creators Club membership, you can even use it to develop games for the Xbox 360.

查看更多
登录 后发表回答