PDA

View Full Version : OpenGL or DirectX?



Michael
02-12-2000, 05:08 PM
What are the advantages and dis-advantages to using one over the other? And which one is easiest to learn for a complete newbie? Thanks!

Gorg
02-12-2000, 08:25 PM
Advantage of Opengl:

very portable(availble on a lot of platform)

direct3d, only on windows

Opengl Much more easier to learn than directX.

Disavantages, well I am not experienced enough in directx to draw other comparisons.

Michael
02-12-2000, 10:08 PM
Hmm, I guess I'll go with openGL then... One question though: To view openGL you need a 3d accelerator right? Do you know if it's the same with directx?

tcs
02-13-2000, 03:44 AM
Thats wrong. You could run a OpenGL application on a software only system with about the same image quality as on a hardware accelerator. Try this with a D3D Game ;-)

I would chose OpenGL. It is much easier to learn, far better documentated. I have started learning OpenGL about 5 months ago. Now i'm coding a outdoor engine with a really big terrain, trees, model loader code physics and a skybox. I really love gl...

Tcs

Michael
02-13-2000, 09:56 AM
ok, sounds good. Thanks! So where should I start with the easiest tutorial possible for a total newbie?

Gorg
02-13-2000, 10:44 AM
go there
http://www.gameprog.com/reference/docs/refarticlelistuser.asp?catid=31


and read the opengl programming guide.

this is better than any tutorial as it explains all the basic of opengl.

Have fun

tcs
02-13-2000, 12:49 PM
Try http://nehe.gamedev.net/
its a great site. I have learned much there.

Michael
02-13-2000, 06:29 PM
Thanks everyone!

Mike The Spike
02-13-2000, 09:55 PM
Use Direct 3D Retained Mode, it's the easiest sollution out there.

Mike The Spike

Micke
05-28-2001, 04:53 AM
Originally posted by Mike The Spike:
Use Direct 3D Retained Mode, it's the easiest sollution out there.

Mike The Spike

Yeah. If all you wanna do is a spinning ball without fog and alphablending and at a frame rate of 10fps on a GeForce card. http://www.opengl.org/discussion_boards/ubb/smile.gif

Zy
05-28-2001, 08:09 AM
Here's the next question...Which is faster in drawing polygons? If I had the same exact equivalent of each APIs drawing code, which will yield the higher frame rates?

05-28-2001, 08:17 AM
To system dependant.
But then again think of this, OpenGL is not designed to run fast its designed to look good DirectX is made to run fast but not look good so why does it out perform DirectX on a properly supporting system?

Stumped?
Answer:
Microsoft.They can't make crap work right or good.

05-28-2001, 10:26 AM
Yes, it depends on the drivers. Both OpenGL and Direct3D is APIs for the same video hardware.

OpenGL is designed to run fast but you also have easier(?) but slower functions for the same thing. In my opinion is that a major advantage, you can write small simple program easier and faster. Direct3D on the other hand tries to forbid slow code but that can also makes it harder to do small apps that just do not care about performance. I read a post in the advanced forum from one of nvidias OpenGL driver programmers and he has the opposite opinion but I do not know why.

Another similar difference is that Direct3D tries to collect data in structures before calling the functions. DirectX is COM based and that can be annoying particular for small programs. OpenGL is more traditional. Microsoft has a OOP based framework for making the above easier but perhaps not so easy as OpenGL...(?)

Perhaps the biggest difference is how the APIs will be extended in the future. OpenGL has a mechanism that allows ATI, NVIDIA and other hardware vendors to add extensions. If the extension is being established and good will it be accepted in the core OpenGL standard after a while. This is also pretty traditional you can compare for example with the C++ standard.

DirectX has a more "exprimental" design. Every new version is really a whole new API! The latest does not have to share anything with older versions. They has promised to distribute _all_ older versions also this is possible because of COM. The programmer must say which API like D3D 3,4 and so on that he wants to use. Everything is standard from the beginning but can be gone in the next release. Microsoft has 100% control and does not allow any hw extensions.

Play around with both but forget about Direct3D retained mode since it was dropped several years ago and is not updated any more.

05-28-2001, 01:12 PM
OpenGL is designed to run fast but you also have easier(?) but slower functions for the same thing.

my point was GL's first priority is that it looks good speed was secondary while with DX its just the reverse.

MrShoe
05-28-2001, 09:52 PM
OpenGL is much much better in every way, performance, ease of use, documentation, looks, and everything else. Just look at a game like UT, then run it in OGL and then in D3D, you decide.

zed
05-28-2001, 10:17 PM
i'ld be surprised if unreal ran faster with opengl than d3d. have you run benchmarks?

T2k
05-28-2001, 11:57 PM
maybe i'm wrong, but do DirectX use the opengl.dll/opengl32.dll for drawing ?

AndersO
05-29-2001, 12:27 AM
DirectX using OpenGL for drawing?!.. That would be the biggest api scam to date! http://www.opengl.org/discussion_boards/ubb/smile.gif

No, DirectX (ddraw d3d) dont use OpenGL. Atleast not that I know of.

Pherhaps there are wrappers, functions on top of opengl that looks like d3d. But thats another story.

05-29-2001, 12:48 PM
Originally posted by bla:
my point was GL's first priority is that it looks good speed was secondary while with DX its just the reverse.

Perhaps but if you mean that something that could increase performance was sacrificed can I not agree. Take immediate mode and vertex arrays. Both are supported and the programmer can select between them.

I guess we have the same opinions about DX but I think they failed. You have to do some "artifical" programming but the reward in speed increase seems to be zero.

05-30-2001, 01:27 AM
OpenGL and DirectX both have their advantages... I think OpenGL is easier to start with in the beginning. But if you're having a lot trouble with maths, it will get a lot harder, because you have to do alot by yourself....

OpenGL doesn't take care of sound, music and input events (keyboard, mouse, joystick). So you'll need to implement that yourself or us an existing library/API that takes care of that... www.openscenegraph.org (http://www.openscenegraph.org) is one of them.
OpenGL was created primarily for computer graphics.

DirectX takes care of all multimedia devices... Enumerating a joystick is not too hard, the same thing with playing sounds.
x

In the end it isn't easy to say which one is better... ppl saying one is crap are being as mindless as with the whole Windows/Linux discussion. I think it's better to try both a bit...

But OpenGL is better to start with...
Good luck
OpP

element
05-30-2001, 10:27 AM
Originally posted by MrShoe:
Just look at a game like UT, then run it in OGL and then in D3D, you decide.

UT (Unreal Tournament) was designed around the glide format of 3dfx. It was the ported to D3D and OpenGL. So this is a bad app to use as a comparison.

Perhaps you should look at something like Quake3 Arena. This was done in OpenGL and had better polygon capability than the Unreal engine ever did. Another major difference however was that the Unreal Engine was easier to mod than the Quake engine. Whether that was because of tools developed to do so within the app or the framework of the engine is not clear to me since I haven't done any modding on them.

Now I'm not sure if the reason Quake had better polygon capability was because of the choice of API (OpenGL) or because Carmack is just a better programmer or what. But the fact remains that the Quake 3 engine does allow for more polygons on screen at one time with great framerates, so long as you ran it on an NVidia card which suported OpenGL properly unlike the 'hack' MiniGL drivers 3dfx supplied to their users in the beginning.

boy that was a long rant sorry.

Randolph
05-30-2001, 11:58 AM
I think that question "What is better?" has very limited sense. DirectX is Windows-integrated, OpenGL is not, but try use your OpenGL windows exe file on other platform :-)

DirectX and Direct3D as a part of it was designed for game programming under windows, OpenGL was not. As for me, I think, that the choice between these is subjective, and if hardware manufacturers give us both models, why not use them both?

e-coli
05-31-2001, 12:10 AM
discussions like this will never end until the fat lady sings. Why even bother? I started using directx but turned too OpenGL because of portability. newbie game programmers tend to use DirectX cause it´s a package, everything you´ll ever need is allready there. This discussion will be even worse when OpenML is released....

harsman
05-31-2001, 04:28 AM
FYI the reason Unreal is so slow at hardware rendering is that it uses lots c-buffers and other CPu consuming stuff to reduce overdraw. Might speed stuff up with software rendering or a vodoo 2 but on anything more advanced it becomes hopelessly CPU-limited.

Deiussum
05-31-2001, 05:08 AM
I like OpenGL better than Direct3D for a number of reasons. You should note, that even if you use OpenGL for graphics, there is nothing to stop you from using other things in DirectX like DirectInput, DirectSound, and DirectPlay. My advice would be to spend some time learning OpenGL, and when you feel comfortable with the basics, at least take a look at Direct3d and draw your own opinions. Many people find OpenGL easier to learn. Others find Direct3d easier to learn. It's all a matter of opion.

Even though I prefer OpenGL, you have to admit that the advent DirectX did a lot for the gaming industry on the Windows platform.

pATChes11
05-31-2001, 10:40 AM
Yes, it certainly did. I think that there are a few reasons many people use DirectX over OpenGL. Part of it is that it is now an integral part of Windows, and it would seem that Windows would favor it for speed instead of OGL. Second, DirectX code is somewhat easier to read and more organized, and already containts functions for handling all the math involved in programming, like matrices and sorting. Those are things that many developers are too lazy to handle themselves. Descent 3 is very good in this manner though... I love that game, and its moddability makes it all the more fun. Too bad it's Glide optimized... anybody got a hell of a good wrapper?

D'OH! Sorry http://www.opengl.org/discussion_boards/ubb/smile.gif But seriously, OpenGL does provide more control of things, and I like the extension system in it.

rpxmaster
06-05-2001, 06:57 AM
Originally posted by Michael:
What are the advantages and dis-advantages to using one over the other? And which one is easiest to learn for a complete newbie? Thanks!

Of course, OpenGL is better than DirectX. I have both SDKs, and I prefer the OpenGL one better, so let me explain why.

>What are the advantages and disadvantages to using one over the other?

OpenGL supports more languages. Ada, Fortran, C, C++, Java, Visual Basic (which isn't really a language, it's more like a toy) and that's just the short list. DirectX only supports Visual Basic and C++.

OpenGL is cross-platform, meaning if you write your code a certain way, it will compile on almost any machine minus Unix. DirectX will only work on some versions of Windows. Microsoft has problems getting DirectX to work on their own Windows 2000 :)

DirectX is FAT; if you've ever been to the download page, it's a HUGE 141MB download, for the 8.0a SDK. Even people with cable modems have problems downloading this. How about OpenGL? I can just use the stuff that comes with my compiler to create OpenGL apps. Note that they do have a partial download site, but just for the C++ portion of the DirectX 8.0a SDK takes up 55MB.

The DirectX board, also known as the MSDN Online User Comments, SUCKS; there are more anti-MS comments on there than there are helpful comments. People usually spend the time flaming each other, or are trying to convice others to use Linux or OpenGL or Borland rather than saying something that has value. The OpenGL Discussion & Help Forums is just great, since people do remain civilized here.

Like DirectX only works on their operating system, it also only compiles on their products. You can only get apps that use DirectX 8.0 to compile on either Visual Basic or Visual C++. I can get OpenGL to compile on the Borland command prompt tools, which is an advantage, meaning you don't have to blow your money on a piece of crap MS product to use it.

>which one is easiest to learn for a complete newbie?

Hmm...OpenGL. I use NeHe's tutorials myself. Have fun.

Nutty
06-05-2001, 08:21 AM
Well said rpxmaster.

Nutty

Rob The Bloke
06-07-2001, 03:47 AM
Originally posted by rpxmaster:
OpenGL is cross-platform, meaning if you write your code a certain way, it will compile on almost any machine minus Unix.

should be....

OpenGL is cross-platform, meaning if you write your code a certain way, it will compile on any machine.

You seem to forget that SGI machines are unix based. http://www.opengl.org/discussion_boards/ubb/smile.gif

06-08-2001, 08:00 AM
Here is my quick take on OpenGL vs. Direct3D:

Both of them have their advantages and disadvantages. They are just tools though. Just learn what you want and implement your ideas using it. If it isn't sufficient or your mind isn't geared towards it, then switch to another tool. As long as you complete your objective, it's just a tool.

Now that the zen talk is out of the way...

OpenGL is cross-platform and simple.
Direct3D is cross-platform only within Win32 and is not very simple to use for the typical programmer. Direct3D 8 is a vast improvement over Direct3D 7, but still.

I would learn both. Just because I want the most tools at my disposal. X-Box is going to use Direct3D. Direct3D drivers are generally more mature also (nVidia is the exception, their drivers are probably the most mature drivers for consumer hardware).

In closing, realize that OpenGL is just a specification and standard. It's the implementation that actually determines the quality of the tool and how ideal it is in terms of the standard. Direct3D is controlled by Microsoft, hence they have absolute control over it and can do whatever they want. OpenGL is controlled by a board and any "Extra" features are implemented through extensions.

Use whatever you feel can finish your project.

-xor

PS. People say that OpenGL is an old and outdated standard. No, it's a solid standard that will be guranteed to work (that's why it's older). Any extra features are implemented through extensions. So it gives the hardware vendor more control over how their extension is implemented and the developer may take advantage of these. How is this accomplished in Direct3D?

masonium
06-17-2001, 06:37 PM
The Perfect blend:

OpenGL with DirectInput and DirectSound

'nuff said.

TheHero
06-17-2001, 09:13 PM
When I began programming using the 3D APIs I bought a book on both OpenGL and Direct3D and from what I can tell OpenGL is by far the easiest to learn with. There exist two reasons for this:
1) Initialization of OpenGL is very easy.
You can write a simple OGL program in less than 20 lines; it doesn't do much, but it works and shows a triangle or something. I have never seen a Direct3D program come close to 20 or even 100 lines. Even using the wrapper classes provided in the SDK fail to make D3D easy.
2) OpenGL is more flexable.
As I understand it everything that can be done in OGL can be done in D3D (or at least almost everything) with similar performance results. However, the complexity of implementing these features (for me) is dramatically different. OpenGL's simplistic glEnable() and other functions allow incredible flexability in the rendering of just about everything. Direct3D on the otherhand... well its a lot of work (to me at least) usually involving the filling of some giant structure to envoke the simplest things (Like a rendering surface). Needless to say I prefer the OpenGL simplicity, allowing me to control program opperation rather than the other way around.

As a side note:
I believe that in a full professional program (like a game or something) D3D and OGL are perfectly acceptable. D3D is probably better if the program needs to run on old non NVIDIA hardware and OGL is probably better for audiences with more modern hardware. Furthermore D3D's complex program structure is of little consequence in a large program taking away one of OGL major benifits (at least as I see it)

So in answer to the original question:
OpenGL is most likely (unless your crazy about structures and wrapper classes) the easier API to learn. OpenGL is perfect for small programs to learn 3D programming where D3D becomes chaotic.

P.S. I am not really qualified to make any sort of credible statements about OGL and D3D because I have never written much of anything except a couple of side scrolling games, so take my opinion with a grain of salt (or a bag)

ffish
06-17-2001, 09:24 PM
Not meaning to be rude, TheHero, but did you see when this question was posted? 14 months ago!! I'm pretty sure the original poster would have decided by now which API to use!

Can we _please_ let this discussion die? I know it will always come up again and again but it is such a useless religious war. Obviously people on this board will support OpenGL and people on a DX board will support DX.