Thread: OpenGL or DirectX ??

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    1

    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.

  2. #2
    Registered User valaris's Avatar
    Join Date
    Jun 2008
    Location
    RING 0
    Posts
    507
    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.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    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
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Why am I a programmer? shoutatchickens's Avatar
    Join Date
    Mar 2008
    Posts
    45
    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.

  5. #5
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    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?

  6. #6
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    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.

  7. #7
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    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.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  8. #8
    Registered User
    Join Date
    Jun 2008
    Posts
    266
    OpenGL. I can't stand programming just for one operating system only.
    Fried chicken for everybody!
    -Kernel Sanders

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    > I cannot stand slow-evolving APIs that are falling behind time
    Howso? :\

    exclusive OO is not the "future".

  11. #11
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #12
    Why am I a programmer? shoutatchickens's Avatar
    Join Date
    Mar 2008
    Posts
    45
    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.
    Last edited by shoutatchickens; 12-31-2008 at 09:25 AM.
    One of the disadvantages of being a 22 year old RPG programmer is having to repeatedly explain to your friends that you don't make videogames for a living.

  13. #13
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489
    If both of them fails, try to use software (GDI/?) the slowest 3D driver but the most portable ever.
    Just GET it OFF out my mind!!

  14. #14
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    And also the slowest, probably failing to reach playable speeds.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  15. #15
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    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.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Going from DirectX to OpenGL
    By Wraithan in forum Game Programming
    Replies: 19
    Last Post: 02-24-2006, 11:07 AM
  2. Allegro, OpenGL.. or even DirectX?
    By Zeusbwr in forum C++ Programming
    Replies: 1
    Last Post: 11-14-2004, 08:16 AM
  3. Which is better: OpenGL or DirectX
    By Stan100 in forum Game Programming
    Replies: 2
    Last Post: 05-09-2003, 04:43 PM
  4. OpenGL 2 or DirectX ?
    By alex6852 in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 01-02-2003, 02:31 PM
  5. So.. what's the difference between DirectX and OpenGL?
    By QuestionC in forum Game Programming
    Replies: 6
    Last Post: 01-19-2002, 06:18 PM