Should I go with directX or openGL
#1 Members - Reputation: 125
Posted 02 July 2012 - 08:13 AM
#2 Members - Reputation: 337
Posted 02 July 2012 - 08:42 AM
If you're just starting out as a programmer you might want to consider some 2d lib instead of using ogl or dx right away as you will progress faster to make your first game.. I havent used any of them as I started with ogl at university, but others could help with that or it shouldn't be to hard to find some info.
If you still want to go with an API you probably want to start with opengl.. Its easer to get help and its an easier interface to start off with..
#3 Members - Reputation: 777
Posted 02 July 2012 - 08:59 AM
#5 Members - Reputation: 163
Posted 02 July 2012 - 09:50 AM
Someone once told me learning C++ was like learning how to juggle knives...
<= Servant of the Lord, on 06 June 2011 - 04:43 AM, replied:
That's not true at all! C++ doesn't require anywhere near the hand-eye coordination juggling requires. And with C++ after you slip and kill someone with the knife, you can reuse it for something else afterward. With actual knives, you have to get rid of the evidence.
#7 Members - Reputation: 3839
Posted 02 July 2012 - 11:45 AM
Ultimately you should learn both - neither is 100% superior to the other and having knowledge of both will give you a more well-rounded perspective. Learning one will not prevent you from learning the other, and there are a lot of core concepts that are common to both.
Each has a subtle but significant difference in approach. D3D tends to expose what's on the hardware and only what's on the hardware whereas OpenGL tends to abstract things a little more. There are advantages and disadvantages to each approach, with D3D needing slightly more work here and there but OpenGL making it a little harder to find the fast path owing to software fallbacks.
The quality of D3D drivers tends to be higher but OpenGL is a better option if portability is important to you.
D3D has vastly superior tools and documentation available; unfortunately OpenGL just can't compete in this respect. OpenGL is also hampered by the fact that a lot of the info and tutorials available on the web are seriously out of date (many were never much good to begin with) and will lead you into bad habits.
In terms of ease of use there is next to no difference whatsoever between the modern versions of each API. You'll be writing almost the exact same kind of code with GL3.x+ as you will with D3D10/11, and the main differences will be just in the API calls (e.g. glMapBufferRange vs ID3D11DeviceContext::Map) - the surrounding C++ code will be effectively identical.
OpenGL does have an older "immediate mode" which many may find easier to get started with and which D3D has no equivalent of, and also still retains a fixed pipeline option (deprecated in modern versions but in practice it will always be available - at least for the foreseeable future) which modern D3D has done away with (it's still in version 9 though). Be cautioned that this is only easier for relatively trivial operations (the number of glTexEnv/etc calls you need to get the equivalent of one line of shader code can be quite staggering), you will be getting poor performance from it, and overall it's considered one of those "bad habits" I mentioned earlier.
Many older versions of D3D do come with helper interfaces for easier handling of sprites, meshes, shaders and so on, but these are being phased out in more recent versions.
So, as for which of the two to pick up first, you can more or less flip a coin. Each is an excellent introduction provided you avoid the more common pitfalls.
Edited by mhagain, 02 July 2012 - 11:46 AM.
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
#8 Members - Reputation: 125
Posted 02 July 2012 - 11:49 AM
Anyway, I'm thinking of doing that pong game in SFML and take it to completion just to get a basic idea of what's involved in making a full game.
#9 Members - Reputation: 125
Posted 02 July 2012 - 12:00 PM
#11 Members - Reputation: 3839
Posted 02 July 2012 - 12:48 PM
For D3D the SDK tutorial material is very good but you probably need to supplement it with further info from elsewhere. The ToyMaker site was one I found useful years ago - http://www.toymaker.info/ - and I've heard very very good things about Frank Luna's books but don't have direct experience of them myself.
But overall once you have one you don't really need much in the way of tutorials for the other. You'll know that you need to (for example) map a dynamic vertex buffer and write data to it, so you'll find it easy enough to just search for the relevant terms and find the info you need.
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
#12 Crossbones+ - Reputation: 1179
Posted 03 July 2012 - 02:41 AM
Most of this stuff is still there to be honest, Maths has moved into the XNA math lib(as of DX11), effect framework into a standalone lib that you still have to compile (as of DX11), texture and shader loading is still in D3DX for all versions. DX10 still provides an effect and math framework.Many older versions of D3D do come with helper interfaces for easier handling of sprites, meshes, shaders and so on, but these are being phased out in more recent versions.
The only thing we lost is the ability to create simple 3D geometries through D3DX like: spheres, boxes and sprites and fonts (and for the last two that's also only true since DX11).
Also a good tutorial site is http://codesampler.com as they provide GL and DX (8.1 and 9.0 only though) samples which accomplish the same thing, but you have to be able to learn from source code with these tutorials.
Edited by NightCreature83, 03 July 2012 - 02:41 AM.
#13 Members - Reputation: 382
Posted 03 July 2012 - 03:23 AM
Other than that they are pretty much the same to work with.
Also, if you ever want your game to work on something other than a Windows Desktop PC, then there is no choice... OpenGL is the only way to go.
#14 Members - Reputation: 3839
Posted 03 July 2012 - 03:44 AM
.....unless that something is an XBox or Windows mobile device....Also, if you ever want your game to work on something other than a Windows Desktop PC, then there is no choice... OpenGL is the only way to go.
But a good point and it does raise a slightly thorny issue. Many of the devices for which you'll commonly see portability claimed for OpenGL actually use GL ES. There are similarities (ES is heavily based on desktop GL) but there are also huge differences, and much of what you'll find in full desktop GL just isn't in ES. So you can't just write a desktop GL program and claim portability to these devices, and when you see portability claimed for OpenGL you need to be aware that in many cases it really means just "Windows/Linux/Mac (or any other platform for which a full desktop GL implementation is available)".
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
#15 Members - Reputation: 382
Posted 03 July 2012 - 04:02 AM
.....unless that something is an XBox or Windows mobile device....
Can we even develop using C++ for those devices? Surely Microsoft has restricted us to using C#/XNA only for them unless your games company gets a bespoke contract with them.
As for OpenGL ES, yeah your right. The larger issues I ran into is that unless using an old device I had to develop code very similar to if I was targetting the core profile on the desktop version (which we all should be ;). Perhaps the biggest issue however is rigging the damn thing up to whatever windowing system the device uses. Eeek, no Glut!
(Sorry, I am taking this a bit off topic, I don't even know if the OP wants to write mobile / unix applications lol).
Edited by Karsten_, 03 July 2012 - 04:04 AM.
#16 Members - Reputation: 777
Posted 03 July 2012 - 04:12 AM
Yeah you can only code in C#/.Net with XNA without the Dev Kit.
.....unless that something is an XBox or Windows mobile device....
Can we even develop using C++ for those devices? Surely Microsoft has restricted us to using C#/XNA only for them unless your games company gets a bespoke contract with them.
As for OpenGL ES, yeah your right. The larger issues I ran into is that unless using an old device I had to develop code very similar to if I was targetting the core profile on the desktop version (which we all should be ;). Perhaps the biggest issue however is rigging the damn thing up to whatever windowing system the device uses. Eeek, no Glut!
(Sorry, I am taking this a bit off topic, I don't even know if the OP wants to write mobile / unix applications lol).
#17 Members - Reputation: 1408
Posted 03 July 2012 - 06:41 AM
#18 Members - Reputation: 132
Posted 03 July 2012 - 12:33 PM
That being said, since DirectX is limited to Mircosoft platform, you cannot use directX code anywhere else. And DirectX 11 and more is more suitable to desktop PC games and Xbox. Windows 8 RT will have directX support but I am not sure it will be the full DirectX 11 API.
So I think, if you think you want to give a try to iOS or Android soon enough, then OpenGL is the best (only) choice. If you only care about Microsoft platform, then DirectX.
In reallity, if you plan a carreer in graphics engineering, you will be working with whatever API your company is using. So get started with one API if you have the choice now, and study the other API when you have the time.
#19 Members - Reputation: 241
Posted 03 July 2012 - 12:53 PM
I'm amazed NV and AMD haven't got together to create a new, truly portable, API. It would life a gazzilion times easier for developers on non-console hardware. Even Windows RT could run it (although it would seriously piss off Microsoft!) if it were totally driver based.
#20 Members - Reputation: 132
Posted 03 July 2012 - 01:57 PM
I'm amazed NV and AMD haven't got together to create a new, truly portable, API. It would life a gazzilion times easier for developers on non-console hardware. Even Windows RT could run it (although it would seriously piss off Microsoft!) if it were totally driver based.
Fortunately, both API are not so different (at the level of OpenGL 2.0 and DirectX 9) that there is huge work for developpers to convert OpenGL code to DirectX and vice versa... Still, it takes some time and some thinking. Especially if you are in a hurry...






