Why is OpenGL better than Direct3D?

To Revolver :

You said that there are issues in OpenGL with determining which feature will be accelerated or not… I agree.

But does it mean that Direct3D does not have this problem ? That would probably mean that we can go back to use a Matrox Millenium instead of a GeForce (why spending a fortune if D3D accelerated everything !). I believe this issue is ALSO a D3D issue…

Eric

Now, to Revolver and TheGecko : what exactly do you call “real” programmers ?
If the topic itself did not start a war in the forum, your answer to this question might !

Eric

I agree with John that 2d in OpenGL is not anything harder to do than 3d, it’s actually easier. And where the hell did Revolver get that you get SUB-1 fps if you do 2d in OpenGL? That’s a pure lie! It may not use 2d capabilities of the graphic card but rather render flatly in 3d (but that shouldn’t be any slower), so it can’t be slower than rendering in 3d.

I don’t know what your problem is with determining which features of opengl are accelerated or not. the OpenGL spec says that a conformiing library MUST be able to do features X, Y and Z. If the underlying h/w has no idea what some or any of these features are, the OpenGL library MUST do them in software. It’s one of the reasons why OpenGL is portable: you can be assured that any opengl client can draw, for example, a textured triangle. Why? Because it’s in the SPEC.

I don’t know much (nay, anything) about D3D, but what I’ve gathered is that if the underlying hardware doesn’t support a feature, then the programmer MUST supply their own software renderer for it, because D3D doesn’t want to know. Yes, I realise that this is mapping to the capabilities of the hardware, but… really. Who wants to waste time writing a render library? It’s a solved problem! There are tonnes of other interesting problems to worry about then whether your software will work on a taiwanese 0% compatable dodgy video card. Really.

Oh, and about the h/w accel thing… so, OpenGL will do something even if the h/w doesn’t want to know about it. If YOU want to know about it, try profiling your engine? (Even the SGI documentation suggests this as a good idea. Check out the PDB library as a profiling database)

cheers
John

What I said about real programmers…I meant programmers in the game industry who REALLY know these API’s.This was bad choice of words on my part and I apologize.

Now as for this whole 2D issue,what revolver said was true.I try to draw an 800x600 bitmap on the screen (running at an 800x600 resolution) and I don’t think I even got 2fps! I have no idea how the other guys here in this forum managed their 2D GUI stuff (while doing 3D at the same time) and this has sparked my interest.I used the glDrawPixels function to draw my bitmap. If someone else here has another suggestion (and it works) by all means post it up or send me the info!

The problem is expressed here:

“I was just making an observation that there is this Anti-Microsoft atmosphere going on here”

Why can someone behave as a policeman for Microsoft? Can we allow Microsoft to be treated as God? Yes for either question leads to an anti-democratic attitude, and eventually to be illegal.

To behave like a policeman or God is characteristics of all criminal actions: stalling, wife beater.

To John :

There CAN BE a problem with knowing which feature is hardware-accelerated. Of course, whatever hardware you are using, OpenGL will draw the scene (as long as you don’t use extensions but we can check this when starting the program !), which is GOOD.

The thing is, I designed some cool effects (without using ANY extension) on my GeForce that looked CRAP on a TNT Ultra because of speed issues : the T&L Hardware Acceleration made the difference !

Of course, this is not a real issue as you can render one frame, and check if it was fast enough ! Moreover, even with the same graphics card, PCs never behave the same (different main processors, different mobo, different whatever !).

The point was : it is good to be able to render the same scene on any machine but the fall back to software rendering can kill ! I think on D3D some features are not available if you card isn’t good enough (ok, don’t flame me if it is not correct, I am not a D3D expert…) instead of emulating them by software…

Well, that’s enough for me : why not starting a “Why D3D is better than OpenGL ?” on a D3D forum ?!?

Eric

TheGecko:
The reason you app runs slow is that you use the glDrawPixels function. This function is slow because all the data is in the system memory and has to be transferred to video memory every frame. You should use lines, triangles and such just as in 3d, and for pictures you should use textures. I would recommend that you scale you 800x600 bitmap to 512x512 or 1024x1024 and load it as a texture.

[This message has been edited by Humus (edited 05-04-2000).]

“Real programmers”? Real programmers would not use DX because in DX you worry too much about the code, and producing it. A simple app in DX can be up to 1500 lines of code, while in OpenGL…10 or 20 lines can produce something simple. Real programmers would actually want their apps to see the light of day eventually, and not dig through 1500 lines of messy code. Real programmers would care about the final output of their scene, and instead of being stressed out over working 24-7 at the computer trying to make something in DX, they would think about the final output while writing the program, and this is easier in opengl since it makes more sense; opengl makes more sense because it doesn’t use COM…

Humus: I understand that I can do all my 2D functions by pasting them on a 3D polygon as a texture map.But you are all still missing my point.I DON’T WANT to use a 3D polygon. My whole point is the 2D aspect of OpenGL and not what methods I can use to work around it. Say I wanted to program a game based entirely on bitmap (think Command & Conquer or PacMan) I would not use OpenGL to do all this but rather DirectX. (I’m not flaming you.You’re right about using a textured polygon but what I’m getting at is doing 2D in OpenGL is not a good idea.)

Alan W: Your argument makes no sense because most of the gaming industry uses DX and to say that they are not “real” programmers (according to my defenition) would be an entirely false statement.

I don’t even know why this post is still going on I’ve already gotten my answer from all of you and concluded it’s all opinion based.Nothing else.

TheGecko:
Well, if you can tell me what is the difference between a bitmap and a texture i could understand you problem. If i would do a bitmapbased program i would use textures, and not some bitmap function since it is much slower … even if i would have done it in DX. The only difference is that a bitmap is resident in system memory, but a texture is (usually) in video memory. The limitation here is that textures has to be 2^n x 2^m, but not so many graphic boards today supports non power of 2 textures anyway.
I can’t see why there should be any problem of doing 2d in OpenGL, i have never gotten into any problems.
And the reason that most game developers are using DX is that they (as the rest of the industry) is following microsoft blindly. Stick with microsoft and you get your money … it’s just like that …

TheGecko:

Most game developers don’t have a choice as to what API they use; it’s usually chosen for them by a manager, who is often someone who isn’t aware of the differences between the APIs and chooses more for political reasons.

To say most developers choose DX is not necessarily correct, especially in the FPS arena (which is one of the biggest), where OpenGL is almost exclusively used.

Also any products that use one of the Quake-engined games (of which there are a lot) use OpenGL only because that is all the Quake-engines support.

But in the end, as you say, it’s all opinion, and makes very little difference. Choose the API you feel most comfortable with. I have; I have used both and all future projects will be using OpenGL.

Ciao…
SHAYDE

OPEN Graphics Library!!
Yes!

Use opengl because it’s not microsoft… please use it because MS is being not cool. You do not want microsoft to have a monopoly do yo???

50 yrs down the road: This is Microsoft House version 4.5…

Thanx for your replies Humus ans Shayde.

Humus:
What I’m getting at is you can’t do REAL 2D in OpenGL without a drastic drop in framerate.(When I say true 2D I mean no 3D whatsoever such as pasting a texturemap onto a polygon.)I would think it would be more complex to make a 2D strategy game like C&C in OpenGL using the methods you have described.I would be much more comfortable making games like that using DirectDraw.

Shayde:
You are a little misinformed about the games industry.It’s not the management that decides which API to use.It’s the Lead programmer and he chooses based on what OS he’s going to program for and functionality etc. etc(I got this from Game Developer Magazine ).And what you said about the FPS is partially true.Quake3 and other games that use it’s engine use OpenGL but there are also other FPS games that use DirectX (Unreal Tournament) And besides,the FPS market is just a protion of the games industry.Like I was stating,using true 2D in OpenGL isn’t a good idea and this is (prolly) just one of the reasons why most of the industry uses DirectX (DirectDraw specifically) Besides,DirectX is made for specifically for games while OpenGL is made for generally any 3D application (medicine , CAD,games etc) It just makes more sense to use DirectX,no?

I’m not saying I’m pro Microsoft.I’m more open minded and I support both Linux and Windows and both API’s OpenGL and DirectX. BOTH have their advantages and disadvantages that make me decide which to use.

My $0.02 (once again )

Ease of Use
The same time it took me to figure out Direct3D and write a minimal application, I was able to write my own 3D engine in OpenGL.

API Design
I must say that whenever I look at any DirectX code I just say yuck. I was able to teach myself OpenGL, just by looking and some examples and just messing around. As with Direct3D, it was painful going through all the variations I could think of just to get my hardware card to initialize.

Well, on a personal note… it’s good to be back on the discussion board. I’ve missed you guys.

/skw|d
www.QuakeRally.com

TheGecko: I’d be more than a little surprised if most companies allow their lead programmer to make decisions like that. No development firm would allow a project if the lead programmer decided he wanted to code everything in Assembly under Linux. Those GameDev articles; were they referring to specific (and possibly atypical) companies or in general?

It is true that First Person Shooters are only a subset of the industry, but they are a big subset and the majority of interest seems to be in this area at the moment.

BTB. Unreal Tournament also supports OpenGL.

Regarding using OpenGL for 2D (time to stick my nose in this side of the argument ) - you can do pretty much do all your 2D stuff using textured polygons drawn using the Orthogonal mapping. Apart from supporting a few more raster ops, I can’t see there’s any extra benefit using DirectX’s 2D functionality as opposed to using generic polygons. Unless, of course, you want frame-buffer access which is an area where OpenGL falls down.

Ciao…
SHAYDE

BTB. It has become pretty obvious to me that the debate of Direct3D vs OpenGL is much like past arguments, such as Amiga vs AtariST, or Windows vs MacOS (or Linux), etc. Each side firmly believe their side is the correct one and they have loads of reasons why they think their side is the better one. But no matter how much they try they cannot convince the other side and these arguments just go nowhere.

So basically no-one here is going to convince anyone else here that Direct3D or OpenGL is the better option - it’s something you have to decide on your own, either by trying them both out, or for strategic reasons.

Ciao…
SHAYDE

I can’t resist making a comment or two. I am just now getting into 3d programming and I was having a hell of a time deciding which to use: OpenGL or DX7. I program using Satan’s latest OS, W2k.

Based on the two books I have read, (Inside D3d and OpenGL Programming Guide) OpenGL looks a lot better. I must admit an initial bias towards Satan’s 3d API, but OpenGL just seems cleaner based on what I’ve read. Having not yet coded a single line in either, my oppinion is probably of little value on this topic.

However, with respect to the great Satan, Microsoft, I would like to voice a more informed opinion. Microsoft got where they are now by having products that were “good enough” and having even better marketing and distribution strategies. To become a monopoly in the PC OS market, you have to start with a salable product. You can’t corner the market on OS’s like you can gold or oil.

Another interesting fact. Office has higher market share on Apples than it does on PCs. Come on now, tell me about all the back-door advantages Microsoft had coding for the Mac OS.

Another intersting fact, Linux has become successful in spite of the awesome forces of Satan deployed against. The fact that Linux is so popular (I personally like Linux and used it in a production system in 1995, before it was “cool” to do so) is clear and convincing evidence that MS does not have a monopoly on OSs.

I am not saying MS is lily-white virginal, but they way some people talk, you would think MS had personally stolen their first-born child.

IE 3 was far more stable than Nav 3 and was more compliant with Netscapes own specs on cookies. I know this from personal experience. Netscape was never making money on their browser and never planned to. Anyone that has bothered to look into the facts know this.

And that leads me to my final comment on MS/anti-trust. This suit was originally started primarly by Netscape and Sun. Netscape has since been purchased and doesn’t really care anymore. Sun has been in this from the beginning to advance it’s own corporate agenda. In fact, I have to admire Sun for doing such a good job of beating MS at it’s own game.

Where’s the hue and cry about Sun owning Java and selling hardware at the same time? Do you guys like Scott McNealy so much that you trust him never to get greedy? Shouldn’t the government jump in and force a break up of Sun and split off Java before Sun develops into a Satanic force in the universe like MS?

Hello once again

Have any of you guys tried to put,say,a background image in your 3D applications using OpenGL? Picture this,you have a nice 800x600 bitmap of the beach which you want to throw into your upcoming game and you want it to take up the whole screen (naturally).Now,using the methods you all have described of scaling the bitmap and then texturing it onto a polygon,don’t you guys see that the image is,well,ugly? I mean the bitmap is now stretched and produces an awful featherd effect.You see what I’m getting at? The image quality doesn’t look so good compared to what I can do in DirectDraw by just drawing the bitmap and then creating 3D objects infront of it (naked chicks in bikinis )

This is my problem with OpenGL.I mean,if directX can do it then why not OpenGL? This point has me stumped.Unless of coarse that’s what they’re working on for the next release version,then ignore my ramblings.

Shayde:
Like I said,there are alot of influences that make a team (or the lead programmer) decide what to program with.If I was making a game for Windows,then why not use DirectX? I mean DirectX was built for games and for Windows! It’s just a purely logical choice to use it.If however,I wanted my game to be ported to other OS’s then I would have thrown DirectX out the window (no pun intended ) It’s not totally about politics and money,there are other determening factors involved.As for those of us here who program for a hobby,then the only thing that matters to us (according to all these posts) id the ease of use of the OpenGL API and it’s portability.Not much else.
As for what you said also,I have NO intention of convincing other people which API is better.The reason why I started this topic is to get some solid concrete evidence why OpenGL is better than Direct3D.All I got were opinions and no benchmarking.Of coarse in this case you guys raised some very important issues that got me thinking.

Now,if you goto a DirectX board and start a topic “Why is DirectX better than openGL” then you guys are going to get people who will give their opinions and say that DirectX is better because… I expected most of (or all) the people on this board to back up OpenGL,this came as no surprise to me.So what better place for me to start this post and see why you guys like it so much.

My only grudge against OpenGL is the whole 2D issue. (NO POLYGONS! I REPEAT…NO POLYGONS! JUST PURE 2D.I have my reasons) Once they fix that (if they do intend to fix it) then I’ll be pure OpenGL all the way

Gecko:
I think you are missing something here… any scaling of a graphic will produce an error to some degree, be it DirectX or OpenGL. All you need is an image the size of your desired resolution and there will be no distortion.

OpenGL is an API, a standard for graphics programming. It has been around longer than DirectX has and is very solid in design. Developed by SGI, a company dedicated to 3D hardware and software, it’s sole purpose to allow developers to write programs that could be run on a varity of different mainframes and workstations. It was only when J.Carmack ported Quake to GLQuake, that the gaming industry really took notice of OpenGL. (Because of the easy-to-use API, he was able to port Quake over the weekend). If a company wanted to add a feature to the API they can through extensions, but with DirectX Microsoft has the final word. And we all know how they have controled the market.

It is entirely up to you as the programmer to decide which API to choose. But I strongly suggest that you try both APIs before you make that decision. A little bit of research will save you hours of development.

/skw|d