Skip to main content.
May 17th, 2006

Direct3D vs OpenGL, 2006

On my current 3D engine, I’m supporting both Direct3D 9 with HLSL and OpenGL with CG.
With some effort, I managed to get a hold on the CG interface for OpenGL.. cool !
Then I noticed that Microsoft is starting to push Direct3D 10. D3D 10 seems to make some effort to deal with state changes in an efficient way, and generally to keep up to date with the evolution of 3D hardware, while also removing a lot of ambiguities with the infamous “caps” and forcing hardware manufacturer to include a base set of capabilities on any hardware that wants to be certified as D3D 10 compatible.
cool cool.. what’s uncool is that OpenGL is starting to look very old ! I was once a great supporter of OpenGL, back when D3D was a real pain to use. D3D used to be almost as painful to use as DirectShow (be DS damned in hell !), but eventually grew to become actually more clean than OpenGL.
OpenGL is continuously developed by a committee, which takes ages to implement anything. Implementing a decent off-screen rendering interface took ages. There so so much bureaucracy.. bha ! Its main problem is that it’s stuck with a design thought for a client-server system, where a client terminal makes API calls to a server that renders. We are talking ancient times, stuff that suited SGI hardware (which BTW just recently filed chapter 11.. sad !). OpenGL functions don’t deal with structures, which are sometimes very useful, and don’t have return values, which makes error checking rather painful.

So I’ve been thinking on ditching OpenGL ! (imagine, me doing that !). The only valid argument for using OpenGL is if I want to write portable code for MacOS X and Linux and PS3. But.. that’s pretty much a bunch of horseshit ! The “portable API” is a joke when dealing with advanced 3D graphics. Plus, who cares about MacOS X and Linux ? It’s a geeky excuse. As for PS3.. who knows what sort of extensions does its OpenGL use ? Writing an engine on top of D3D and OpenGL is inevitably going to have to penalize one side of the porting while taking a lot of time to keep the development in synch: not worth it.

ummmmm.. I wrote a lot and it’s late. I actually meant to leave the second part of the update for something completely different. But that will have to go on the next bat-update on this same bat-site !

Posted by Davide Pasca in Programming, 3D Graphics

This entry was posted on Wednesday, May 17th, 2006 at 2:08 am and is filed under Programming, 3D Graphics. You can follow any responses to this entry through the comments RSS 2.0 feed. You can leave a response, or trackback from your own site.

6 Responses to “Direct3D vs OpenGL, 2006”

  1. Ragin' Lion says:

    Yeah, DX10 is begining to look really nice now. The only problem is that you’re gonna need Vista (and possibly a SM 4.0 card) to use it! It’s not such a problem … just waiting for Vista to be released then we buy a whole new system.

    I’m taking the “use OpenGL ES on PC” approach if I’m going to do stuff on PS3 … well when they release Linux for it *and* I can save up for a PS3! (^-^)

    I can’t remember for sure, but I belieev OpenGL 2.0 is supposed to be released later this year or next year. It basically gets rid of the legacy OpenGL stuff.

    But you are quite right though; at this point the whole concept of “API” is begining to fade away with GPUs. It’s like having an “API” to program a CPU. It’s a shame that everyone can’t agree on a standardized GPU programming language … at least not yet anyway.

  2. thePomy says:

    So at least, MS gets all…. Resistence is futile you will be assimilated.

    ^___^

  3. Davide Pasca says:

    > Ragin’ Lion
    DX 10 running only on Vista is a bit of a pain indeed. But honestly, I find DX 9 already more useful than OpenGL.

    OpenGL 2.0 is actually already here, but it seems that nobody noticed. Prompted by your post, I went on to search, and indeed, there is a planned change: PureOpenGL 2.0 is supposed to take over next. PureOpenGL 2.0 is basically OpenGL 2.0 with stuff removed (fixed pipeline among other things.. like D3D 9 on XBox360 and D3D 10 on PC).
    Still, I don’t see it worth it.. all things considered, OpenGL doesn’t really count that much for games, especially on consoles. PS3 uses OpenGL ES + CG, which is definitely not OpenGL 2.0.. especially, CG negates the usefulness of GLSL (the shading language of OpenGL 2.0) as CG is basically HLSL.
    I’m also told that PS3 has another, lower level library that can be used with CG… so OpenGL ES isn’t really a must on PS3.

    > thePomy
    In this case MS had the balls to drive change. D3D started ugly, but eventually got better. I started using Direct3D only from version 9, but I’m told that changing from 7 to 9 was a pain. But then again, legacy support is a big pain ! If there is anything that needs to be constantly rewritten when doing games, is the 3D engine..

  4. rince says:

    I never used opengl, but started with d3d version 3.0 as my 1st pc-pased graphics api. And I have to say that in my
    opinion the earlier versions of d3d were closer to what console programmers expect.

    For example if I remember correctly in d3d version 3.0 you had to build your own command buffers in memory that included vertex data
    data. draw commands, texture setting, render states etc… Then people started complaining that it was too complex and difficult so
    later versions of d3d started hiding the command buffer building from the programmer, but exposed some higher level api calls
    like DrawPrimitive, SetTexture, SetRenderState etc etc… Which made programming easier, but removed the direct control that
    one had. Then the Xbox came out with d3d 8 and suddenly people wanted all the control back, because that is what you need
    on a console, so in d3d 8 on the Xbox you have the concept of a pushbuffer which is pretty much what d3d 3 already had =)

    The big pain with early versions of d3d was the capability querying interface. But that was not really the fault of the api, but
    more the fact that there were so many different hardware graphics cards manufacturers. And the d3d api was basically saying:
    “here, I can tell you what this hardware is capable of, but its up to you to decide what you want to do with this information”
    which is pretty much what Sony’s approach was with the PS2.

    So to sum it all up I find it strange how console programmers prefer opengl over d3d, because if anything then d3d is closer to
    what they are used to dealing with on a console….

  5. Davide Pasca says:

    > rince
    Early D3D was quite a pain just to setup ! It was based on RenderMorphics. A library built for software-rendering. It had already index buffers I think… but at the time, 3D hardware wasn’t supporting index buffers. Clearly meant for the CPU to optimize the number of vertices to calculate while decoupling them into triangles to feed to the hardware (which was doing only rasterization). Nonetheless, one had to set up those buffers, checking on the caps for the size, as if they were really going straight into the HW pipeline.
    One also had to check on available texture formats, available texture memory and had to update texture memory in case it got “lost” !
    OpenGL had nothing of that because in a sense it implied a standard set of features. Back then it wasn’t easy to force hw manufacturers to follow some standard, and I guess MS didn’t feel like it had enough leverage to try impose minimum requirements.
    D3D 10, in a sense, gets closer to OpenGL as it sets a minimum needed feature set. Having to discover and use specific features isn’t an issue on consoles, but it’s a nightmare for PC development.. which is what D3D was initially used and meant for… in that setting, it was a real pain !

    Dunno now if console programmers still prefer OpenGL.. I guess there aren’t too many alternatives, since D3D is very much by MS for MS.

  6. rince says:

    Well on the ps2 you also need to set up buffers in main memory and then dma them, and you need to manage vram and there is
    no hardware index buffers or hw transform and lighting either, you have to do everything yourself. Thats why I am saying that
    earlier versions of d3d were more similar to programming on a console.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>