Fog Creek Software
Discussion Board

OpenGL or DirectX?

Developing a real-time simulation requiring real-time 3D graphics rendering at high frame rates.  We can dictate what it deploys on (Unix or Windows), probably will be Windows.

OpenGL or DirectX?  OpenGL is/was the domain of SGI, who lately seems a candidate for The Tank.  However, it runs on many different platforms.  DirectX makes us a Microsoft shop, but that is what most of the customers have anyway, and it seems the most recent version of DirectX (9) is pretty good and has some pretty spiffy optimized graphics hardware available for it on the cheap.

Would appreciate any first hand experienced comments and comparisons.  John Carmack?  Take a minute off from Doom and lemme know what you think here.

Mitch & Murray (from downtown)
Tuesday, August 5, 2003

Flip a coin.

Tuesday, August 5, 2003

What development platform are you planning on using? (C++, Java, .NET)? 

DirectX9 has managed libraries for DirectX which supposedly give 85-90% performance of an unmanaged C++/DirectX app(so I've heard from a game developer friend @ Maxis)

The .NET Framework may give you speed of development advantages over C++ - yep you'd be locked into Microsoft's .NET platform, but if you choose DirectX, you're already locked in...

It's food for thought.  DirectX also has some spiffy features that take advantage of some of the newer technology (last I checked) that OpenGL didn't support (maybe it does in OpenGL 1.3)

Personally I'd go with .NET/DX9, but I'm a business app developer who's hobby used to be messing around with DirectX & GL....

Tuesday, August 5, 2003

I'm for OpenGL myself.

Note that many of the newer features are available via OpenGL extensions, so are not part of the main spec.  See for a list of extensions, a link to their specs, and a list of what cards support them.

As for speed, I can render 800,000 triangles in 125ms on a Radeon 9000 using the GL_ARB_vertex_buffer_object extension.

Tim Evans
Tuesday, August 5, 2003

What's your market want? I'd like to be able to advocate OpenGL, but I am not certain of a few things:

* How good OpenGL support is across the platforms you need on the cards you need
* How well OpenGL handles unavailable extensions/capabilities

I put big value on being able to run it under Linux, because that's what I use. But does your market touch that? As I recall, DirectX drivers are easier to write, and therefore card support under Win is usually better. Extensions are proprietary, so some cards support feature XYZ, some don't.

I don't see OpenGL dying. Partly because of the non-Windows support (I don't see Mac dying, so...), and also because of OpenGL 2.0 and Carmack (id's games will be extremely popular for the forseeable future, and I see card manufacturers catering to that need).

There's other reasons, but OpenGL 2.0 adds a lot of features as standard, and hopefully addresses (I do not know, myself) some of the above problems.

So does your market fit OpenGL? If it does, and your knowledge of the APIs does not tend more towards DirectX, then by all means use OpenGL. Otherwise...

*Big* downsides to each of them.

Mike Swieton
Tuesday, August 5, 2003

From your description of the requirement, either would be fine.

Wednesday, August 6, 2003

Ive only dabbled abit with each of them, but OpenGL was easier to get started with if thats a factor.

Eric Debois
Wednesday, August 6, 2003

GL is definately easier to get started in and also tends to be easier to wrapper a scene graph around, from my experience.  Direct3D tries too much to be object oriented, to the detrement of your ability to wrapper it.

What generally has been happening is that Direct3D has been becomming more GL like and the GL supporters have made sure that most if not all of the Direct3D unique features are available as extensions.

Pretty much, if performance is important, it's probably the case that your users won't be using the lesser graphics cards, they'll probably have one of the popular ones with good GL drivers.

Flamebait Sr.
Wednesday, August 6, 2003

To echo what others have said, it depends upon your needs. 

If you're going to deploy on anything other than Windows, the choice is obviously OpenGL.  If Windows-only, take a look at both.  OpenGL was significantly easier to get started with in the past, which led to things like Carmack's famous statement that Direct3D is "broken", but keep in mind that was all in the past.  D3D9 is nothing like D3D3.

And to counter those who say OpenGL is still much easier to get going with: again, it depends.  It is much easier to get OpenGL to render a single triangle on screen, but what if you're loading flexible 3D mesh data to render?  Well D3D has its own mesh format (.X files) that can be exported from all major 3D modeling programs.  OpenGL has nothing similar, so you need to write (or find/license 3rd party) libraries to do this task for you, which can be a significant time drain.    So YMMV as to which is really easier to start using, depending upon very specific usage needs.

In the end, either will likely suit your purpose just fine no matter what zealots on either side might tell you. 

I'd be happy to be more specific in my recommendation if you can give more info on exactly what it is the program will be doing, where its data will come from, etc.

Mister Fancypants
Wednesday, August 6, 2003

*  Recent Topics

*  Fog Creek Home