🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DirectX vs OpenGL

Started by
14 comments, last by Qoy 24 years, 7 months ago
I know I'm not going to make any friends saying this, but the way things are shaping up these days Direct3D is the better choice for making games. I say this for a few reasons.

First, and I know this has been said before, it has much better driver support from 3D card companies. There's just no question about it.

Second, its development is geared entirely toward the game development industry. New features are added to Direct3D almost concurrently with their release in consumer 3D hardware. A good example would be the addition of hardware T&L that almost perfectly coincided with the launch of GeForce. All in all, the Direct3D feature set will be expanding much more rapidly that that of OpenGL.

Finally, it really is no more difficult to use than OpenGL. Actually, now that DX 7 is out and there's the D3DX utility library available, I find it considerably more easy to use and straightforward. Setup can be performed in but a few lines of code.

The only benefit that I can think of to using OpenGL is the fact that it is portable across god knows how many platforms. But then again, if you've got the manpower to make a multiplatform product, you'll probably want to use both APIs anyway.

The way I see it, OpenGL was really in interim solution to the need for a good stable 3D API while Direct3D was still in its infancy. Now that Direct3D is surpassing it in functionality and ease of use, there's really no reason to go with OpenGL unless you're concerned with porting your application to platforms other than Windows.

Advertisement
Good points =).

And if you use openGL, you can count on bad
performance on cards that are not fully openGL compatible. ( Like MatroxG200 ).

Well I'll first start by answering the questions that Qoy asked, then I'll address the other replies...

OpenGL is an extremely well-written, high performance, platform independent 3D graphical API. It is easy to use, powerful, flexible, and well-documented.

As far as features go, OpenGL and D3D/DD are essentially equivalent. I'm fooling around with a 2D wrapper for OpenGL and it is faster than DD as it renders textures using the 3D hardware instead of blitting them.

D3D does have a slight advantage in driver support, but this has been diminishing greatly over the past two years. Any major graphics card will have an OpenGL driver.

The biggest myth I've been hearing from D3D advocates on this message board is that D3D is rapidly adding new features. The reason D3D has been adding this "new" features (stencil buffer in DX5 or 6, T&L in DX7) is becausing OpenGL has had them all along. If board ABC comes out with some new XYZ feature, then they only have to add an extension to their OpenGL driver and developers can use that feature. Meanwhile, D3D developers will be sitting around hoping that the next version of DX supports it.

While Shinkage might that D3D is easier to use, the overwhelming consensus(sp?) is that OpenGL is much better written and easier to use. I'd have to address with the majority based on my first-hand experiences over Shinkage's obvious bias.

I won't even address the ignorance in Shinkage's final paragraph.

Programming is a zero-sum game. I don't win or lose depending on which API you prefer to use. But working with OpenGL has been a pleasure for me so I highly suggest you try it. It allowed me to spend more time learning about graphics and less time worrying about COM programming.

Why is the whole DirectX vs. OpenGL debate the one area where you never hear The Word According to Carmack. I don't want to parrot Carmack, but id Software seems committed to OpenGL. This brings up a few observations.

(1) id is a technology driven company. Their specialty is pushing the limits of hardware, not telling stories, etc. I think everyone would also agree that id isn't interested in cutting corners or taking the easy way out. If D3D was vastly superior, they would use it.

(2) If any video card company doesn't consider having decent support for games based on the Quake 3 Engine part of their business strategy, I'd like to know about it, so I can forward their management Foodstamp Applications. How many games are going to be based on that engine? Who spends the money on higher end video cards?

That being said, I prefer OpenGL because it allows me to concentrate on more important things, like the GAME. It also works like a standard C library, instead of a Windows C library(which I prefer), and I was able to master OpenGL in a three day weekend.

As an amatuer/hobbiest I'm going to benchmark against my machine. I try to use structured programming so that it will be easy to optimize for different configurations if I can, but practically it doesn't do any good to try and optimize for other machines since I'm don't have them to debug on. It drives me crazy every time I see a 555/565 question on Gamedev. I know it's inevitable, but someone working on weekends and night should be able to set that junk aside and work on the game. I've seen too many projects die because people were worried about inlining assembly, 3DMax exporters, etc. before they even had a basic engine with a framerate (or even basic code structure) to compare against. You can't optimize until you can tell if your 'opimizations' make the program faster or slower than a previously measured rate.

Anyway, that's why I like OpenGL.

-the logistical one-http://members.bellatlantic.net/~olsongt
This just to address a couple points made against Direct3D previously.

"The reason D3D has been adding this "new" features (stencil buffer in DX5 or 6, T&L in DX7) is becausing OpenGL has had them all along. "

The reason for this is because these features just did not exist in any consumer level graphics hardware (which is what Direct3D is targeted at.) There is no reason to pollute the API with features that are not available.

Features are added to Direct3D usually just before they are available in hardware (such as texture transforms, cubic environment maps, HW TnL in the latest release.) This is due to continued feedback between the Direct3D developers, ISV's, and IHV's.

We're also seeing the API pushing hardware in certain directions. For example, in DX6, DXTn compression was added as a standard compression scheme. It was only available in S3 cards. Now, we're seeing the same compression scheme in Nvidia's GeForce 256, and I believe in 3dfx's upcoming chipsets (in addition to the FXTn compression.) This would not be happening if D3D employed an extension mechanism, and compressed textures were only exposed through an extension.

Up until now it is true that OpenGL has generally had all the features that Direct3D has been adding. At this point, however, with their feature sets being roughly equivalent, I see Direct3D expanding much more rapidly than OpenGL. Being designed for games, it has to keep up with the modern consumer hardware while OpenGL has no such need. Additions to OpenGL are made much more slowly and deliberately.

As for this 2D wrapper that was made in OpenGL that used 3D hardware to do the rendering, the same thing could just as easily be done in Direct3D, so that's not really a good reason to chose one over the other. In fact, with the D3DX utility library Direct3D now has functions designed specifically for this purpose.

One reason I would NOT choose an API is because somebody else uses it. From what I've observed, Carmack had such a dislike for Direct3D when it first came out (and there really wasn't much to like about it), that he wholeheartedly embraced OpenGL. Once you're familiar with one there's really no point in changing, at least right now. Whether or not it is smart business strategy to not fully support OpenGL, past examples show us that many GL driver implementations have been shoddy at best.

The most common thing I see people saying about OpenGL is how they can "focus on the GAME instead of the GRAPHICS". I'll admit that when you still had to use execute buffers and were forced with all sorts of unpleasantness with previous incarnations of Direct3D this may have been true. With DirectX 7, however, I invite anybody to give me an example of how OpenGL is substantially more easy to use than Direct3D. I have so far found none and would honestly like to see what OpenGL has going for it so that I can be more informed in my decision.

While on the surface it may seem that Direct3D has been pushing hardware as of late, I think it is really the other way around. Microsoft surely has meetings with the industry giants (Nvidia in particular it seems) and coordinates with them in implementing in DirectX the features they are planning for their next-gen cards.

As for Kyle's rather insulting comment, simply saying "That's so stupid I don't even need to talk about it," is just a clever way of saying that you either don't have a convincing argument to the contrary or do not want to take the time to explain it. In the former case, just saying nothing would not only serve to not alienate others, but will also not detract from the coherence of your argument. If the case is that you just don't want to fully support your point, then you should not bother posting in the first place.

Nothing like a good argument though. Really gets the mind working.

Oh, and with some final words to the original poster, you can listen to people argue convincingly either way until the universe grows old and dies and still get nowhere. Just try to be impartial and honestly spend a little time getting the basics of both of them down. After doing so you can make an informed decision of your own. That's how I eventually made the decision.

OpenGL... Go with OpenGL.. It seems to work for ID, why shouldn't it work for you?? I wouldn't even consider DirectX myself, but that's my opinion. I would have to agree with Kyle up there that OpenGL is extremely well written.. And on top of that, it is platform independent.. (make MY mouth water) Also, as with hardware T&L, Microsoft had to add that functionality, whereas OpenGL takes advantage of it all along... For example: If QGLQuake, or Quake2, etc.. Used OpenGL's transformation routines then it would automatically take advantage of that Hardware T&L crap... Another point, OpenGL is easier to learn and the curve isn't so freakin' steep.. DirectX docs suck, OpenGL docs are GOD... DirectX implemention sucks, OpenGL implementation is GOD... Oh, and if you are wondering about compatibility issues, don't they are fixing those problems by putting out there own ICD implementations of GL OPTIMIZED for the card. OOOOoh don't you just love standardization....
Edmund Weese7-bit Games
"Up until now it is true that OpenGL has generally had all the features that Direct3D has been adding."
This is a misinterpretation of the facts that D3D has not had all of the features of OpenGL until the latest release.

"Being designed for games, it has to keep up with the modern consumer hardware while OpenGL has no such need."
OpenGL keeps up with high-end hardware, which is why it had support for T&L, stencil buffer, etc. long before it was plausible to put these features on consumer hardware.

My 2D wrapper was used as an example because the original poster asked how D3D and DD compared to OpenGL. I was addressing his questions about versatility and functionality.

I agree that one should not use any API because somebody else uses it. But Carmack was already using OpenGL before he tore apart D3D by saying it has "no technical reason for existing."

"Whether or not it is smart business strategy to not fully support OpenGL, past examples show us that many GL driver implementations have been shoddy at best."
You were talking about developers and then jump to IHVs so I am unclear as to what point this was an attempt to make. Games are being made (and have been) with OpenGL as the main (or only) 3D API so I will give the benefit of the doubt that Blizzard (DiabloII), id Software (Q3A), and Bungie (Halo) know more about smart business strategies that us. (And yes I know that a game can only support D3D and will be fine, I just wanted to make that point that OpenGL can also be the main/only 3D API for a game.)

OpenGL drivers are available for virtually every video card now. While this wasn't always the case, it is now else I doubt it would be a "smart business strategy."

Well I guess I will address Shikage's last paragraph now (which I said was ignorant, which differs from stupid.)

"The way I see it, OpenGL was really in interim solution to the need for a good stable 3D API while Direct3D was still in its infancy. Now that Direct3D is surpassing it in functionality and ease of use, there's really no reason to go with OpenGL unless you're concerned with porting your application to platforms other than Windows."
You really think that SGI developed OpenGL so programmers would have something to play with while Microsoft was trying to add all of the features to D3D that OpenGL had while MS was trying to make it easy to use? While a minority have said that D3D is now as easy to use as OpenGL, I will give you the benefit of the doubt and say that it is just as easy to use. So now D3D and OpenGL have virtually the same learning curve and virtually the same features, so that means that D3D is _surpassing_ OpenGL in these categories? This just isn't the case and that is why I said his paragraph was ignorant (ill-informed, or perhaps it was just biased), not stupid.

I do not know all of the reasons that Carmack stated that D3D has "no technical reason for existing", but has to wonder why MS has spent the past few years building D3D and pushing it onto IHVs, ISVs, and developing drivers for it something equivalent to OpenGL when they could have just worked on OpenGL drivers and given developers and consumers the same technology a few years ago.

Lets see if we can settle the OpenGL vs D3D debate for now and all time.

I tried to be clear in the last post, but I guess I wasn't. I was being slightly sarcastic about "Carmack said so." with the main point being that ID uses GL and they concentrate on the technology end of things. Big companies that want to concentrate on story/ gameplay are paying hundreds of thousands of dollars to have access to this GL based technology. Obviously, there are alot of other reasons they're buying the engine, and OpenGL is probably one of the least important factors, but it's clearly not holding any of these companies back.

Also, D3D advocates make it sound like all these 'high-end' features like T&L, stencil buffer, and alpha that are just finding their way to the consumer market involve some sort of crazy implementation for the end user(programmer in this case), but they're all as simple as glEnable()/ glDisable() and maybe some gl___Parameteri(). It's not like you're adding all kinds of crazy data structures and doing all this work to implement advanced functionality. It's just as easy as drawing a poly.

I'd also like to bring up, just because I saw it mentioned here and in a few other threads, OpenGL was designed as a general purpose 2 and 3D graphics package, so you can do straight 2D graphics without dummying up a Z coord or anything. You just use verticies with two coords.

And just so everyone doesn't think I'm 'death before D3D' here's one area where OpenGL loses out due to it's general purpose archtecture. It can't take advantage of hardware Transformation for weighed verticies attached to a skeletal system, since you can't adjust the matrix in the middle of a poly, which is a pretty big deal. (I'm a bit reluctant to believe that D3D actually does all those transforms via hardware, but thats another thread) So you're still stuck doing character transforms with the main CPU, unless you go memory hog wild and set up a mesh for each anim frame ahead of time. (Luckily, my current game consists mostly of severed ninja heads, so I can treat them like rigid bodies)

-the logistical one-http://members.bellatlantic.net/~olsongt
I have to concede to the fact that I'll never be able to convince people that Direct3D is a worthy alternative to OpenGL if they are dead set against it. I'm sure OpenGL works out very well for those who use it and I am not trying to say that it is completely inferior to Direct3D.

I realize that for a long time OpenGL was a superior API to Direct3D. The time that this was true, however, has passed. At this point it's really an issue of which interface you like more, and for me that is clearly Direct3D. I will say one thing though, neither API more difficult to use than the other. I've used both of them and can say that they both have their plusses and minuses.

As for geometry blending in hardware, check out the specs for the GeForce. Unless I'm mistaken, support geometry blending is listed as one of the features. I'll admit though, weighted skeletal animation supported natively in hardware and as easy to use as a call to SetTransform does sound too good to be true.

[This message has been edited by Shinkage (edited November 08, 1999).]

This topic is closed to new replies.

Advertisement