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:37

It is my understanding that in Direct3D you must handle all resource allocation and management yourself, whereas the OpenGL specification leaves this to the driver/implementation rather than the application.

This allows Direct3D developers to use the best allocation and management methods suitable to the application, but is also extra work.

I have done the typical "Hello World" applications in each, and I prefer OpenGL over Direct3D, but that is just my opinion. You should try out both, spend a day or two learning and playing around with each, and decide for yourself.

查看更多
唯我独甜
3楼-- · 2019-03-25 15:38

To answer this question well requires more information about you:

  • what is your programming ability?

If it's high, I would probably start with Ogre (the best strictly rendering open source engine, IMHO) or another open source game engine, such as Delta3D, if you want additional features (sound, physics, etc.) that a game engine brings.

If you don't want to go with an engine, I would go with Direct3D, because it's being updated much quicker than OpenGL. I don't want to get into all the issues, but version 3.0 of OpenGL was announced during SIGGRAPH and most in the community were very disappointed with it. Direct3D puts you in a much better position to take advantage of shaders and other uses of the programmable pipeline.

If your programming ability is not too high, and you are doing this to learn programming, I would start with OpenGL, because it is easier to learn and there are more resources on the web (see http://nehe.gamedev.net for example).

查看更多
爷的心禁止访问
4楼-- · 2019-03-25 15:40

You must remember that DirectX is a collection of technologies - Input, Audio and Graphics. However to most people DX is synonymous with the renderer.

In my opinion D3D (or DirectGraphics) has not really been that hard since DX8. I have not tried DX9 or DX10.

Bernard is right - try to abstract as much as possible. Try to keep DX or OGL calls outside your object classes.

查看更多
成全新的幸福
5楼-- · 2019-03-25 15:43

You have to think about what you want out of it, as it's a hobby project I'm assuming that "learning stuff" will be a major part of the experience so avoid picking up something that hides things from you and does stuff behind the scenes as this will only give you a fraction of the picture.

I'd go with Direct3D because it's got the better support, I find the docs easy to read and there are decent samples that come with the SDK. You can even use these samples as the base to build on if you want to get a kick start without the initial steep learning curve of getting things set up.

I started with OpenGL for the record, and after about a month went onto Direct3d (version 7 at the time). I found Direct3D forced me to be more aware of what I was wanting to do and how I was setting things up but I preferred this level of understanding.

Importantly IMO, whichever way you choose, take it step by step and get things on screen regularly. There's all sorts of reasons why something isn't on screen (it's transparent, the camera's inside the object, etc...) so by taking baby steps and getting stuff to display regularly you're both verifying things are still moving along and getting a little visual reward.

查看更多
聊天终结者
6楼-- · 2019-03-25 15:48

I have no previous OpenGL, DirectX or videogame experience and i have made have an open source race videogame with Ogre3d. Is a very good framework to start in videogames: well done code, plenty of docs and info in the net and very good starting tutorials.

The rendering engine is DirectX/OpenGl agnostic, you can later select to render your game with OpenGL or DirectX (withouth changes in your code)

查看更多
闹够了就滚
7楼-- · 2019-03-25 15:49

Don't start with Ogre.

Start with OpenGL GLUT (Win32), and a tutorial or two.

As soon as you can move to Win32 and take a look at this site, which is pretty old now, but still, quite good.

查看更多
登录 后发表回答