-
OpenGL or DirectX ??
Hello guys!
I want to know what is the best, the fastest, the most powerful, the most difficult to learn, advantages and disadvantes in general between game programming in DirectX and OpenGl.
What´s your opinion? I have seen many very good RPG Games in OpenGL (like Regnum, www.regnumonline.com.ar ) and many others in DirectX..
Can anyone tell me? Thanks in advance!
Ignacio G.
-
I'd say learn whatever. It seems game makers use directx extensively. Learning the concepts of 3d programming is pretty much the same between the two, and probably the most difficult in learning to write 3d/game stuff anyways. If you understand what you are doing when you write 3d stuff in one API...you can probably use the other one effectively as well.
-
As to "which is most powerful" (or "best" in many other ways) it will probably depend on exatly what power you need/want. It's a bit like comparing a Ferrari F50 with a Ford Transit van - the Ferrari will definitely win the "fastest around the racetrack", but the Ford Transit will definitely win the "pack a lot of stuff in the back" competition. Likewise, there are things that OpenGL does better than DirectX, and there are things that DirectX does better than OpenGL. [Note that the Ferrari vs. Ford Transit example is a lot more extreme than the difference between DirectX and OpenGL - they are pretty similar in most ways, and it would probably be more of a case of a Vauxhall/Opel model X vs the corresponding Ford model Y comparison - I use the Ferrari vs Transit comparison because it shows that measuring different things "the best" is a different result- in real things the difference may be much smaller].
Learning 3D Drawing in general is no easy thing - there is a lot of math to understand (not complicated, but a lot of it). Particularly, matrix computations will be critical to understand. Once you understand the concept of movement/rotation using matrix operations, the rest of the 3D work will be fairly easy.
In the past, graphics cards have been designed mainly for OpenGL or mainly for DirectX, but in the recent years, I think most cards do both with pretty good results.
I'm sorry I can't just simply say "OpenGL is better because ..." or "you should use DirectX because ..." - but it's pretty much an arbitrary choice unless you have specific requirements. For nearly everything, you will be doing the same work, the performance will be pretty much the same (limited by some hardware component - for example one of: graphics processor, main processor, main memory bandwidth, graphics memory bandwidth or the bus that the graphics card sits on).
--
Mats
-
I guess an advantage (subjective I suppose) of OpenGL is it could be cross platform.
Other than that is just is going to depend on what you're doing whether one proves more difficult or not.
-
OpenGL is just a standard, it specifies nothing about performance that's strictly implementation dependant (esp. on hardware). As mentioned above, the hard thing is not the API it's the concepts. You'll need a very firm grasp of maths. D3D has good commercial backing, so does OpenGL (in a way...). Which is one of the main reasons D3D is so popular for commercial titles.
Personally I'd say go with OpenGL because it's portable, and very nice to use :-). Although I've never programmed with DirectX before.
> I use the Ferrari vs Transit comparison because it shows that measuring different things "the best" is a different result
And you drive a Ford Transit? :p
-
Which API you use is really up to you. All of the benefits and disadvantages have already been mentioned in this thread.
We really can't tell you which one and there is no right or wrong answer here. Learn the principles and then you can apply them inside of whatever 3D API you want to use.
-
It's also a question of the language you use. If you use C++, you really have the choice. If you use any .Net language, DirectX is much better supported. If you use C, you're better off with OpenGL, because interfacing with COM libraries in C is beyond ugly.
-
OpenGL. I can't stand programming just for one operating system only.
-
DirectX. I cannot stand slow-evolving APIs that are falling behind time ;)
Besides, it also has APIs for other things than just graphics - input, sound (or was this deprecated?), etc.
-
> I cannot stand slow-evolving APIs that are falling behind time
Howso? :\
exclusive OO is not the "future".
-
Of course, this was just an individual opinion against the other "opinion", simply because opinions are not facts, and you should not choose an API depending on opinions.
That said, OpenGL is having trouble right now. The newest revision brought nothing but disappointment and anger from the community, and I like having lots of powerful features - and fast! I do not like waiting lots of years between revisions, and seeing as DirectX was created after OpenGL, and is now equal or surpassed it, it is quite obvious that it is evolving faster.
-
Exhibit A: Unreal Tournament 3
By now you can probably see that it will be a matter of preference. Yes, DirectX may be changing constantly but that can be viewed as good or bad depending on how you approach it. Unreal Tournament series is a good example of a game that give you the option of Direct X and OpenGL. Which will really show you that it is almost completely preference.
-
If both of them fails, try to use software (GDI/?) the slowest 3D driver but the most portable ever.
-
And also the slowest, probably failing to reach playable speeds.
-
Heh, I would argue that OpenGL is more portable than any low-level 2d API you can find. There are very portable wrappers, but they come with trade-offs.