OpenGL to DirectX

Started by
18 comments, last by 21st Century Moose 9 years, 1 month ago

When I was deciding which to learn first, I didn’t ask, “Which makes the other easier to learn oh noes!”, I asked, “Which one do I need for what I want to do right now?”.

Direct3D 9 was the obvious choice for me because I wanted to make games on PC, and then years later iOS devices appeared and then I decided to learn OpenGL.

is it easy to transfer from direct3d9 to opengGL? same reason i want to learn both. and im not saying im going to learn both, i just want to know if it is easy to jump to another api.

Advertisement

thanks all for the answer, i try unity and i find it very easy, you can make games from copy pasting

You can make a game with D3D by copy pasting too, but you won't learn much that way...
You didn't answer if you want to learn how to program a GPU (what GL/D3D are for) or just want to make a game.
Why not make a game from scratch (no copy and pasting) on a real game engine first?
If you don't want to use an existing engine (for whatever reason), you can still use an existing graphics library, which is just a wrapper around GL/etc.
E.g. Look at Horde3D - you still have to write all your own C++ code, but they've abstracted GL from an unwieldy GPU-API into an understandable API designed for people who are making their own game engines.

i want to learn the core of game dev

On a professional game programming team of 20 staff, only one of them will write D3D/GL code - it's a specialist engine development skill, not a core game development skill.

if i choose to start in directx, will it be easy to switch to opengl? or vise versa?

Yes. They're both just APIs for sending commands to the GPU. Once you understand how GPU's work, then learning a 2nd/3rd/4th API is much easier.

When I was deciding which to learn first, I didn’t ask, “Which makes the other easier to learn oh noes!”, I asked, “Which one do I need for what I want to do right now?”.

Direct3D 9 was the obvious choice for me because I wanted to make games on PC, and then years later iOS devices appeared and then I decided to learn OpenGL.

is it easy to transfer from direct3d9 to opengGL? same reason i want to learn both. and im not saying im going to learn both, i just want to know if it is easy to jump to another api.

Do not waste time with Direct3D 9. Direct3D 11 is a better structured API, easier to learn, more powerful and it support down-level hardware trough feature levels (down to SM 2.0x GPUs).

Yes, you cannot target Windows XP with Direct3D 11, but who cares? When you will be able to release something to the public, Windows XP will be like <1% or less of gaming PCs (actually Steam says it's around 4%).

"Recursion is the first step towards madness." - "Skegg?ld, Skálm?ld, Skildir ro Klofnir!"
Direct3D 12 quick reference: https://github.com/alessiot89/D3D12QuickRef/

I would start with OpenGL 3.x/4.x and then go to DX11 once you grasped the initial concepts.

The reason is there are no good in-depth DX11 tutorials the likes of which http://www.arcsynthesis.org/gltut/ but once you know the basics of graphics programming DX11 is more straightforward and atleast I had issues finding debugging tools that worked for OpenGL, while you can use RenderDoc or VisualStudio for DX11, which makes development soooo much easier.

The real question is what you want to do. Do you want to learn the core of 3D rendering? That is procedural meshes and shaders. Do you want to learn rendering in general? Choose one: DirectX or OpenGL. Do you want to write a real game? Don't use either. Start with [a game engine like Unity, or at least an existing OpenGL/DirectX wrapper like Ogre/Horde3D/etc].

^^ this (slightly edited for my opinion).

Well, I did suggest Unity because it is a "big boy" engine that does everything and is very well documented and supported. If he want to create a game, a full featured engine is best, but not necessarily Unity. But Unity also seems a bit more easy to get you hands on and grasp than the CryEngine or Unreal. There are also a ton of engines available, but quite a few have to problem of allowing for graphics that are at most from 2006.

But if the goal is not to write a real game, indeed I would recommend a wrapper. Can be something simple as DirectX TK. Or one of the mini-frameworks from a few popular bloggers. I would not recommend DXUT. And Ogre without precompiled headers takes so long to compile that you can have a meal each time.


But if you want the highest of the high level of graphics, super AAA quality rendering, then OpenGl is inferior. Maybe the latest version is great, but the ones I tried were a lot behind. For starters, a big chunk of OpenGL is implemented in the GPU driver. There is a huge quality gap between supper cheap GPUs never meant to do real rendering work and high quality stuff.
[citation needed]

I can't offer you a citation, only anecdotal evidence.

In historic order:

1. Linux. This is probably the problem of early Linux drivers and not a real problem with OpenGL, but OpenGL reliability on Linux was very bad. Sure, if you ran glgears there were no problems. But if you tried to do more complicated stuff, some things would not render exactly as expected with no way to fix it except to either try to change X setting and mess around with the driver or move to another PC. There were small bugs that effected only parts of it, allowing you to render the scene but some effects would not show up.

2. Windows Vista + some ATI cards. When Vista came out, some ATI cards had broken OpenGL drivers and it took so many months for them to fix it that I gave up on Vista. The performance was very bad.

3. Even today, there can be subtle differences. Things like Toksvig specular AA are highly dependent on the exact behavior of the GPU filtering system. Even right now if I tried, I can get at least 3 different results on 3 different PCs. Same code, same resolution, different GPUs. The probability of getting it pixel perfect is less than in DirectX and OpenGL has no mechanic to report to you that it is doing stuff differently than you would expect. It says: OK, rendered corectly! And indeed there is output on the screen. And if you examine it superficially it looks OK. Maybe just by a little and I had bad luck. But I'm pretty sure it is not higher.

What I got out of all these experiences is a common theme of slightly less reliability. This is of course an issue only on the PC. If you target some hardware that only has OpenGL and historically has only had OpenGL and everybody is using OpenGL do do 100% of the graphics stuff, there will be probably no such issues.

Also I meant to post earlier that Unity can look awesome or generic... It gets a bad reputation because there's so many hobbyists using it, but AAA companies use it to make excellent/polished games too.

Your API decision should be in the back of your mind for now. The bigger questions to ask if you are going to go the API route are :

Do I have the basic knowledge about 3D rendering, lighting , transform , shaders, the graphics pipeline....Without the fundamentals you are going to be stuck in an endless loop of cut-paste-I don't understand this code-post question of a forum for an answer...repeat....

Do you have an background in basic linear algebra ?

Do you have an understanding of the fundamentals of computer graphics.

These should be more important to you than what API to use..because in the end it comes down to syntax...they both do the same thing.

I personally use OpenGL because is clossplatform and the differences of performance with Direct3D are gone. I think also Direct3D has a conflict, is not vendor-neutral standard.

Check this nvidia blog:

http://blogs.nvidia.com/blog/2014/03/20/opengl-gdc2014/

I personally use OpenGL because is clossplatform and the differences of performance with Direct3D are gone. I think also Direct3D has a conflict, is not vendor-neutral standard.

Check this nvidia blog:

http://blogs.nvidia.com/blog/2014/03/20/opengl-gdc2014/

AZDO is effectively dead.

With Vulkan and D3D12 on the way, nobody (outside of tech-demos) is going to primarily write code in the AZDO style because it's essentially unportable to other APIs: no other API works that way, and porting will be non-trivial; it's a complete re-architecting.

To be brutally honest, whether or not an API is cross-platform should be the least concern of anybody starting out. They've enough to learn on one platform; learning on two (or more) is just not being helpful. Better to focus on tools, support, documentation, resources and driver quality. I want to highlight the latter because it's vital for a beginner to be able to tell the difference between "did I screw up?" and "have I got a weird driver bug?" Good driver quality gives them the ability to tell that difference with more confidence. Having to continually fight the drivers ... doesn't.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

This topic is closed to new replies.

Advertisement