Coffeehouse Thread

16 posts

DirectX vs. OpenGL

Back to Forum: Coffeehouse
  • User profile image
    Ion Todirel

    Who is the best choise for game development? Why?

  • User profile image
    cravikiran

    Depends really on what you are looking to do, your experience doing 3d, etc...

    A lot of the commercial game industry uses DirectX so if thats what you are looking towards thats a consideration.

    DirectX includes a lot of multimedia/input stuff as part of its package while OpenGL is just graphics API (you need other libraries if you want to do input, sound, etc.).

    But, I find DirectX is a bit more difficult to learn if you are new to 3d.

    Personally, OpenGL feels closer to how I would like the 3d api to be, given the theory and math behind it.  Its pipeline is very easy to learn and again, the whole API is very natural and consistent (its often described as a big state machine).

    One thing with OpenGL though is that some of the advanced stuff is done through ARB/vendor-specific extensions and figuring out how to use those means digging through documentation from disparate sources, digging through actual specs and sometimes even learning w/o documentation.  There are usually lots of source code and examples from Graphics vendors and stuff though but its still annoying.

  • User profile image
    Minh

    What platform?

  • User profile image
    IRenderable

    Depends. For the "Core" API I could go either way, I don't have a preference. But DirectX comes with D3DX wich handles model loading (I don't use that part personally, the .X format sucks for animation), texture loading, a nice fast Math library, etc. I started off in OpenGL and had to write all the stuff myself, very happy I have D3DX now.

    Alot of the time when people say OpenGL is easy it's because they are using intermidiate mode which while it's nice to learn from, you probally won't use it on any semi complicated project.

    But if you wan't to use multiple platforms(By multiple platforms I mean PC OSs and Macs) then OpenGL is going to be what you want.

    But really, if you know one you can learn the other, I changed from OpenGL to DirectX earlier this year and it was very easy to do. As long as you know the theory (How lighting works, matricies, vectors, etc.) it's easy to switch. It's all preference.





    One thing with OpenGL though is that some of the advanced stuff is done through ARB/vendor-specific extensions and figuring out how to use those means digging through documentation from disparate sources, digging through actual specs and sometimes even learning w/o documentation.  There are usually lots of source code and examples from Graphics vendors and stuff though but its still annoying.


    Thats why I switched personally. It got really annoying.

  • User profile image
    Ion Todirel

    Minh wrote:
    What platform?


    As i know, DirectX is available only on Microsoft Platforms, so lets say WindowsXP. OpenGL is cross platform.

    How about some features of both APIs?

  • User profile image
    Foxfire

    Ion Todirel wrote:


    How about some features of both APIs?


    Some people already said it. You cannot directly compare DirectX and OpenGL.
    OpenGL is only an API for doing 3D Graphics, DirectX contains a LOT MORE like sound, video, input, networking etc.

    If you compare Direct3D to OpenGL then the most notable difference will be that Direct3D is object-oriented while OpenGL is still procedural. The initial feature set of Direct3D is a lot bigger, but OpenGL allows the graphics vendors to create their own extensions to make up for that. Direct3DX contains lots of convenience functions that OpenGL itself does not have.

  • User profile image
    rhm

    OpenGL and DirectX are now equivalent on features. OpenGL did lag for a long time with stuff like pixel shaders only available through the manufacturer extension mechanism, but it's all been standardised now.

    If you plan to ever run your code on a platform other than Windows the choice is obvious. Even on Windows, DirectX isn't a slam-dunk decision. Bear in mind that many popular games do use OpenGL - Doom/Quake, World of Warcraft, etc.  For managed code Managed DirectX has an advantage as you avoid interop. There is talk that Vista will somehow penalise OpenGL apps in some way when the user is running Aero.


    There used to be a big difference in philosophy between OpenGL and DirectX (aside from OpenGL being C-style API and DirectX being COM based). The concept of OpenGL was to provide a core API that apps could rely on always working, with a manufacturer extension mechanism to provide for features that are device-specific. The concept of DirectX was to provide equally for every feature of every card and as a result the API doesn't guarantee the availability of any particular feature (as an example, the old PowerVR based cards didn't have Z-buffers). DirectX developers went through the hell of having to test for every capability they might need in their app and providing different code-paths for when features were missing.

    That has changed with consolidation in the graphics card market. With ATi and Nvidia the only major vendors of cards and them having very similar feature sets, the aim of DirectX now is to force the two companies to provide *identical* features - hence the "shader model level". Games developers can now write simpler code and expect it to work on all recent cards from ATi and Nvidia.

  • User profile image
    Minh

    Ion Todirel wrote:
    Minh wrote:What platform?


    As i know, DirectX is available only on Microsoft Platforms, so lets say WindowsXP. OpenGL is cross platform.

    How about some features of both APIs?

    My exposure to OGL is minimal, but 3D is 3D. The same concepts apply. I had a chance to ask game devs this same question -- and the answer is, undoubtedly, on Windows, it's Direct3D. Rhm mentions a few popular Windows games that use OGL -- but it's because they support Mac & Linux also. But many games are single-platform only and DirectX is the more powerful platform -- though harder for beginners to get started on.

    So the majority of games use DirectX. The Xbox360 uses DirectX. FWIW.

  • User profile image
    Minh

    rhm wrote:
    There is talk that Vista will somehow penalise OpenGL apps in some way when the user is running Aero.

    As I understand it, this is because Direct3D must ALWAYS be running while Aero is active. I suppose you can't have a performant Direct3D & OpenGL running at the same time. So OGL calls are either emulated (convert to D3D calls? or software?).

    rhm wrote:
    DirectX developers went through the hell of having to test for every capability they might need in their app and providing different code-paths for when features were missing.

    It's interesting to note that Direct3D 10 is taking the OGL philosophy -- where as functionalities MUST be implemented by the card/driver.[/quote]

  • User profile image
    IRenderable

    blatzcoder wrote:
    rhm wrote:There is talk that Vista will somehow penalise OpenGL apps in some way when the user is running Aero.
    Note to all...this only changed recently...after a lot of complaints, apparently. Vista was going to slow down OpenGL dramatically, but this is changing.

    link


    It's note changing, it was always FUD.

  • User profile image
    Ion Todirel

    thanks for reply

  • User profile image
    DoomBringer

    I've done OGL, and I didn't like it much.  It was easy to pick up at first, but I really disliked a lot of it.  DX is harder to learn at first, but offers a lot more functionality.

  • User profile image
    Detroit Muscle

    Minh wrote:

    So the majority of games use DirectX.


    Wow, there's some FUD. The majority of commercial computer games today are developed for either the Playstation 2 or Nintendo DS. Neither of those 2 platforms have a DirectX port.

  • User profile image
    Minh

    Detroit Muscle wrote:
    Minh wrote:
    So the majority of games use DirectX.


    Wow, there's some FUD. The majority of commercial computer games today are developed for either the Playstation 2 or Nintendo DS. Neither of those 2 platforms have a DirectX port.


    Ion Todirel wrote:


            Minh wrote:What platform?



    As i know, DirectX is available only on Microsoft Platforms, so lets say WindowsXP. OpenGL is cross platform.

  • User profile image
    DoomBringer

    Detroit Muscle wrote:
    Minh wrote:
    So the majority of games use DirectX.


    Wow, there's some FUD. The majority of commercial computer games today are developed for either the Playstation 2 or Nintendo DS. Neither of those 2 platforms have a DirectX port.

    Yes, but we're talking about PC development here.  Since the PS2 and GB DS don't have public dev kits or whatever, we kinda have to do PC dev.

  • User profile image
    androidi

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.