Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
News

OpenGL vs. Direct3D? 29

sl3xd asks: "When it comes to 3D graphics, there are two main competitors in the 'Mainstream' computer world: OpenGL, and Direct3D. However, aside from the fact that OpenGL is cross-platform, and has an extension mechanism, in what ways is it different than Direct3D? How does each handle the interfaces between the OS and the hardware? What are the rendering advantages/disadvantages to each? Do they use similar mechanisms - are they somewhat similar to program for? What are the advantages of Direct3D over OpenGL, and vice-versa?" Are there other 3D graphic libraries out there that can complete with OGL and D3D that sl3xd might have missed?
This discussion has been archived. No new comments can be posted.

OpenGL vs. Direct3D?

Comments Filter:
  • by Tet ( 2721 )
    You might want to mention that he said this in 1996.

    If you read my post, you'll see that I wrote "a few years ago". That tends to imply at least 3, so I think it covers 1996 (i.e. 4 years ago) pretty well...

  • Oh, and Quake3Arena was more fun that Unreal Tournament. ;),br>

    I don't know...I think UT wins hands-down for out-of-box experience, but Q3 mods like Q3F pick up some slack.

    -Smitty
  • As the title of this post says, the OpenGL v. D3D battle depends largely on the video card used. For example, 3dfx cards do quite well with OpenGL, but are somewhat lacking in their D3D performance. OTOH, nVidia cards aren't all that great with OpenGL, but shine in the area of D3D.

    =================================
  • Direct3D is Microsofts implementation of a polygon-based 3D graphics API.

    OpenGL is SGI's implementation of a polygon-based 3D graphics API

    Direct3D is aimed primarily at the gaming market on the windows family of operating systems, while OpenGL is aimed at cross-platform workstation-class hardware. Both are extensively used in both games and other 3D applications.

    Both APIs offer the developer and end user access to software and hardware based 3D acceleration, as long as appropriate driver support is available from the manufacturer.

    OpenGL is the industry standard in most areas of 3D graphics aside from games, and many games use OpenGL, as well as Direct3D.

    Both APIs are now pretty much comparable with each other in terms of feature support - though Direct3D supports some minor eye-candy functionality that OpenGL doesn't support as part of its core API i think.

    So the choice between the two comes down to platform support and personal preference.

    Direct3D involves total reliance on Windows, while OpenGL apps can conceivably run on any platform there is hardware and drivers for. (i.e. Windows, MacOS, BeOS, Linux,*BSD along with the old-skool workstation-and-server-oriented unix platforms like IRIX, HP-UX, AIX, Solaris etc.

    Both OpenGL and Direct3D are somewhat proprietary APIs, although plenty of documentation is available from their respective owners (SGI & Microsoft) There is even a complete reference implementation of OpenGL available from SGI i believe.

    Personally, i prefer applications and games that use OpenGL, because of the cross-platform nature of the system.

    Also, courtesy of the Perl bindings to OpenGL, i can code 3D apps in Perl with OpenGL which is a big plus :)

    That being said, if your target market is Windows-only, I'm sure Microsoft will bend over backwards to try and make OpenGL as unworkable as possible on future versions of Windows, so you may want to use Direct3D.

  • Tell me you're not serious.

    Windows 2000 is "pretty obsolete", "obscure" and "nearly dead"?

    Here's a point... WinXX is the most popular OS on the planet, like it or not. It is NOT "obscure".

    I think I'm feeding a troll, though.

  • Nvidia not so great with OpenGL?

    Are you insane? They have what is probably the most mature and complete Win32 OpenGL driver on the planet, and currently their hardware has the best bang for the buck on the Win32 OpenGL desktop.
  • I thought i'd add to the comparison by giving an account of my experiences learning the OpenGL API...just for reference, i'm a computer science major still in school (although don't ask me why..).

    I've been studying/working with OpenGL for only about a year now, but my experience with it has been awesome. Previous to it, I had only a done a -very- small amount of coding with Allegro (which is a 2D only API, IIRC). The learning curve of OpenGL, to me, was almost non-existant. It's structure makes sense, the API functions are pretty straightforward, and there is sooo much help out on the web, it's insane (although I imagine that goes for Direct3D as well). And even if you're starting with the very basics of computer visualization and light (how colors work, mathematics of intensity, reflection/refraction), you can use OpenGL as a learning and teaching tool every step of the way.

    Another thing I like about OpenGL, is that it doesn't seem to want to obscure what's going on mathematically; this is one of the things that allows it to be used for things like the Q3A engine. For instance, you have easy, direct access to all the matrices, -if you want it-. Or, you can let the API do the work. good stuff.

    As for the cross-platform thing, the one awesome thing that i've personally noticed about it is that when you learn the OpenGL API, you aren't forced to learn a specific GUI API in the process. I've seen Direct3D code, and mixed in with Win32/MFC code, it can get really really atrocious.

    Overall, OpenGL is fun to work with, and satisfying as well. If yer just breakin' into the computer graphics programming world, i definitely suggest you give it a try.

  • Christ, who the heck monitors ask slashdot for articles to post?

    (And who's idea was it for the lameness filter to look at the subject for "First ever slashdot rant"? Why don't you go for the penis birds or something. Of course, you could just have the lameness filter automoderate down a post rather than just disallow it all-together. Nah, we all want to be small dictators telling everyone else what is "cool")

    I've submitted what I would consider very valid questions that get rejected (I REALLY wish there was a reason line for why an article was rejected, something to think about as a needed feature IMHO) while a question that is very similar, but is almost worthless to me because of the slight differences, gets posted less than a week later.

    Of course, then we have crap like this. This is an extremely old chestnut on usenet and all sorts of websites have been put up addressing it. Even a slight amount of actual work to research the issues would have turned up a few dozen articles that are much better than any of the responses given so far.

    I know, why don't you go to Deja News [deja.com] and look for usenet articles with the title D3D vs OpenGL (Or opengl vs d3d) that constantly get regurtitated every 2-3 weeks from someone new asking this exact same question without _looking_ to see if it is answered anywhere. I'd be willing to even bet this is in the opengl faq (Though I'm not looking in it to find out, I just think it's a safe bet.) Go to the faq [faq.org] repository and look for comp.graphics.api.opengl (or was it graphics.programming.api.opengl?).

  • The next version of Direct3D (v4) will be OpenGL compatible. They (Microsoft) are also working with the OpenGL consortium to generate an improved standard (GL3) that will incorporate many of MSoft's inovations into OpenGL whilst preserving cross-platform compatibility.

    References, please? Maybe I'm just out of the loop, but you'd think either of these announcements would be of a magnitude to be shouted far and wide, on the Slashdot homepage, at least.

    I'm also kind of curious as to why "whois gaming4d.com" and "nslookup www.gaming4d.com", as well as a google search, all come up blank.

    Oh, well. You got an "Informative" so far, so good troll; but you shouldn't have wasted it on a non-front page story where fewer moderators will see it.
  • I can't claim to know the ins and outs of either API, but as an avid gamer, I know that I prefer OpenGL over D3D by leaps and bounds. In my experience (at least on my RivaTNT card), GL yields a marginal to sometimes phenomenal increase in framerate over D3D. In addition, the image quality is almost always noticeably superior.

    I guess I was always under the impression that OGL was a superior API, but that Direct3D was simply easier to program for and better supported. *shrug*

    -Degenerate

  • by crisco ( 4669 )
    I've gotta echo the sentiments of others who've already posted and said this is a stupid question for Ask Slashdot. Predictably, you've received a bunch of wrong answers from ill-informed people.

    But, since you've asked, we're all gonna answer.

    A quick search [google.com] on Google gets us some answers.

    Historically intersting is this commentary [directx.com] on this very topic from John Carmack from December 1996. This article [gamecenter.com] at Gamecenter rehashes Carmack's comments and adds some other game programmer's comments.

    Another spoon-fed link will be GameDev.net's 3D API forum [gamedev.net], where there is a discussion [gamedev.net] on this very topic between people who actually use the APIs in question.

  • There is PEX, which was a 3D extension to X. Seems quite dead now... Or I may be totally wrong...
  • That last link should've been to here [faqs.org] instead of that stupid advertising page. Chances of posting a mistake is directly proportional to how critical your post is of something.
  • 3Dfx doesn't even fully support OpenGL - they use a proprietary version called MiniGL.

    (but you knew that)

  • The whois should works even if your dns server is down *cough*
  • Some good points. Although the 1996 article probably refers to D3D version 2 or 3. Something that I have little experience with, but as far as I understand it, it was based on a bizarre concept of execute buffers (I guess this is something along the lines of putting all commands into an array, and calling a function with the array as a parameter).

    D3D v7 is very much different, with some clear inspiration from OpenGL. To draw a list of triangles, you just need to call the drawPrimitives function, with an array of points (plus a few other parameters). Its still not as simple as OpenGL. OpenGL is very a very simple Logo like language. However, its not significantly more complicated than most other API's (Although Windows itself seems to have a huge wodge of horrible legacy stuff)

    One small issue with OpenGL is that Microsoft isn't too fussy about keeping up to date versions available for Windows. This has the effect of making Direct3D more feature rich under Windows at times.
  • Umm, that doesn't explain why a whois doesn't work...
  • Gotta agree; go ahead, hit me with a "Redundant." I don't mind.

    Seems to me if your user number is over, say, 50, your chances of getting an article posted here are slim to none. Unless of course you're submitting a question to Ask Slashdot whose answer can easily be found (or at least have some light shed on it) by running a simple Google search. Or you're submitting a thinly-veiled piece of flamebait. I think perhaps I'll try submitting "What's the best Linux distribution?" or "Should I turn my boss in for distributing one (1) licensed font on a floppy?" or even "Where is the power button on an NEC Direction 300L?" and see what happens.
  • Direct3D is definitely ahead of OpenGL. Hardware manufacturers like MS' roadmap so they know when they have to implement hardware, and when they do, they know that it'll be supported by an OS (windows whatever). OpenGL is a bit behind, but it's cross platform.

    If you know for a fact that your program is only going to be run on Windows, you're a fool if you use anything but Direct3D. If there's the possibility that it's cross platform, fuck it, use a little bit of abstraction, write the other OSes' stuff in OpenGL and write the Windows stuff in D3D.

    If there are other 3d libraries and such, I'm pretty sure they're just abstraction layers for one API or the other.
    --
    Peace,
    Lord Omlette
    ICQ# 77863057
  • imho opengl performs better than direct 3d. unreal sucks with direct3d, max resolution being 1024x768 32bit and not being very playable - on the contrary, with opengl i can run it 1600x1200 32 bit, without any performance loss. i have 733 MHz pIII (256 megabytes ram) and nvidia's GeForce 256 with 32 megabytes sdram). most other games also perform superior on opengl when compared to direct3d and opengl looks by far better also.

  • 3Dfx doesn't even fully support OpenGL

    That's ok, we've got Mesa.
  • I think you're right about the troll thing.

    It reminds me of a very similar styled troll called 'Steve Woston of JJJJ-JJJJJ-JJJJJ-JJulius games'. He'd say that he's been in talks with microsoft about something, or some major vendor, and talk crap while being unable to source anything.

    Amusing, and goes to show how shoddy moderators are.

  • I guess I was always under the impression that OGL was a superior API, but that Direct3D was simply easier to program for and better supported.

    In my (and many other people's) opinion, OpenGL is a much simpler API. It uses a state machine with a fairly simple set of commands (Along th elines of
    glBegin();
    glVertex3f(x1, y1, z1);
    glVertex3f(x2, y2, z2);
    glVertex3f(x3, y3, z3);
    glEnd();
    to draw a triangle, whereas D3D insists on you setting up an array of structs containing the parameters (e.g. colour, specular, texturing modes) you want and telling the drawprimitives() function which are used. (I make this sound horrible, but it isn't too bad really). D3D is probably a little more efficient, although clever driver coding can improve performance in OpenGL.
  • by Tet ( 2721 )
    Direct3D is definitely ahead of OpenGL. [...] OpenGL is a bit behind, but it's cross platform.

    Erm, no. In what ways do you think D3D is ahead? From a purely personal point of view, coding with OpenGL results in significantly cleaner code than Direct3D. I've tried both, and I liked the OpenGL API, and hated the D3D API. I'm not really qualified to discuss the technical advantages of one or the other, so let hear from someone that is. A few years ago, John Carmack said [directx.com]:

    Direct-3D IM is a horribly broken API. It inflicts great pain and suffering on the programmers using it, without returning any significant advantages. I don't think there is ANY market segment that D3D is apropriate for, OpenGL seems to work just fine for everything from quake to softimage. There is no good technical reason for the existance of D3D.

    He's recently claimed, however (and I can't find a reference, anyone?) that MS have made huge advances, and that people shouldn't judge D3D by previous versions. He claims that the latest version is actually pretty good, although he still prefers, and will continue to use, OpenGL. My take is that if it's good enough for Carmack, it's good enough for me. And of course, OpenGL has the obvious advantage of being available on my preferred platforms.

  • The next version of Direct3D (v4) will be OpenGL compatible. They (Microsoft) are also working with the OpenGL consortium to generate an improved standard (GL3) that will incorporate many of MSoft's inovations into OpenGL whilst preserving cross-platform compatibility.
    References, please? Maybe I'm just out of the loop, but you'd think either of these announcements would be of a magnitude to be shouted far and wide, on the Slashdot homepage, at least.
    SGI and Microsoft had committed to merging OpenGL and Direct3D a couple years back. Several of the top engineers from Cosmo Software stayed at SGI rather than go to Platinum Software when Platinum bought Cosmo from SGI. At the time, it was widlely heralded in the gaming community, and to a lesser extent, in the CAD/CAM and FX communities - there would only be one API to program for (this was when even Wired was running stories like the one of the Apple logo wrapped in barbed wire titled "Pray.").

    However, this was also before SGI started to really tank. And before Microsoft got slammed by the DOJ (causing everyone to want to be as far away from Bill as possible, even Bill, who tied Ballmer to the DOJ stake).

    Since then, SGI has open-sourced Performer, Inventor, and, most recently (and most surprisingly) a sample implementation of OpenGL itself. As SGI has never really understood software above the level of microcode, open-sourcing those made sense. But it also would have fairly kiboshed any efforts to unify with Direct3D - Microsoft and open source? Yeah, right.

    There may be more current scuttlebutt than that, but I haven't made the last two SIGGRAPHs, so haven't had a chance to talk to all the geeks that would have been in the thick of this (Paul Strauss, Rikk Carey, Gavin Bell, etc.)

  • Looks like this was on the agenda once: http://www.eetimes.com/news/97/985news/sgi.html

    Note that this article appears to be from 1997, even though the stupid web designer puts today's date at the top of the page...

    I really hate undated web pages.

    Tom
  • Actually last I heard Tim Sweeney was drinking brandy and smoking cigars with Bill Gates. He uses Unreal as the poster-child of Direct3D. He has some definite misconceptions of the capability of OpenGL compared to Direct3D, and his proposal for an OpenGL extension that would provide for more efficient resident texture memory handling was pretty much laughed at by the industry (largely because he missed the obvious fact that the schemes he suggested within the extension were already supported with the glTexSubImage* functions and the glAreTexturesResident line of functions.) He has long suggested that the Direct3D version of Unreal was much faster and more efficient on his technology page, and yet I must agree with the above poster...OpenGL appears as good if not better. Sweeney may be able to program some mean template classes, but he is no way as knowledgeable about 3D technology as many others in the industry. (Carmack, for example)

    Oh, and Quake3Arena was more fun that Unreal Tournament. ;)
  • In all fairness, this is more of a testament to Unreal's lack of quality D3D code. Only the more recent versions of UT have had code that can compete with OpenGL on any serious level - and even then the Direct3D code is slower and does not look as good.

    But, this can still shed a little light on the subject. The two big games now that really tax your 3D hardware (Quake III and UT) prefer to use OpenGL. Thare has got to be good reason for doing so, or they wouldn't both do it. The only reason may be portability - as it was for Quake - but I don't think that's the case for Unreal. It was first realeased for Windows and released for MacOS a while later. The thing is, OpenGL wasn't even part of the original Unreal. So the MacOS version used RAVE (the MacOS standard) instead.

    The fact thaqt Epic added OpenGL support later, and spent more time optimising it, tells me that they obviously see good reason to do so. I just don't know what that reason would be.

    -Smitty
  • You might want to mention that he said this in 1996. By most all accounts D3D has come a long way since then.

He has not acquired a fortune; the fortune has acquired him. -- Bion

Working...