Home » Community » Forums » » Direct3D vs. OpenGL: Which API to Use When, Where, and Why
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic

Page:   1 2 3 4 5 »»

 Last Thread Next Thread 
 Direct3D vs. OpenGL: Which API to Use When, Where, and Why
Post Reply 
Great article, now I know what API to learn and how much incorrect crap i've been reading about the two. If ever (heh of course it will) a flameware starts again on this subject a link to this article ought to help extinguish it. Thanks for the writeup.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Sense I first start with Direct3D with the release of DirectX 5.0, I had many difficulties starting and getting it to work. Then I moved to the OpenGL when a friend told me about it a few weeks latter. It was much simpler and I could get it to compile and run with out a problem.

I thought that Direct3D would die off after a while, but I guess not. They really improved many aspects of it, and it’s getting closer and closer to the interface to the OpenGL, which makes it easier to program in.

After reading the OpenGL 2.0 proposals I’m wondering how long it will take Direct3D to go that way too. I would be surprised if it doesn’t. But 2.0 seems very powerful and has a huge advantage over Direct3D that comes with DirectX 8.1.

Anyways, the article here was a pleasure to read, and the author’s opinions were very nicely said.


 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

One error: Although I never used DirectX with C (only with C++), I'm pretty sure the C syntax for using it is like this:
D3DDevice->lpVtbl->DoSomething(D3DDevice, Params)
// as opposed to what you wrote, which is this:
D3DDevice->lpVtbl->DoSomething(Params)
 


~CGameProgrammer( );



 User Rating: 1354   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

anyway, this is always true, even after these years:

"There is no good technical reason for the existance of D3D. "






 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by ed9er
anyway, this is always true, even after these years:

"There is no good technical reason for the existance of D3D. "



Hmm, is there any good technical reason to your existence? The question is pointless, unless you are involved in theology.

One thing is missing in this interesting article. Direct3D is not a stand alone GL. It is a part of libraries called DirectX, witch provide network, sound, music, video, input device support (what else do you need?). All those libraries are based on the COM model, that means very structured and OO compliant. If you understand how it works, you know the "grammar" for all other libraries. You only need to learn "vocabulary" as you need it. As long as I know, OpenGL is a GL only. When you have learnt it, then you will have to learn how to use sockets, sound hardware access, etc… Good luck.


DworD


 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by dword2002
When you have learnt it, then you will have to learn how to use sockets, sound hardware access, etc… Good luck.



When you have learned Direct3D, then you have to learn how to use DirectPlay, DirectSound, DirectInput etc... Good luck.

Chris.

PS: libraries like libSDL, OpenAL, HawkNL are your friends.



 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

The article mentions that anything that can be done in DirectDraw can easily be done in D3D. Have there not been articles and forum postings showing that D3D can corrupt bitmaps when transferring them to the screeen?

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I believe John Carmack's original rant was about D3D v3, not v5.

 User Rating: 1579   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by chr1701
When you have learned Direct3D, then you have to learn how to use DirectPlay, DirectSound, DirectInput etc... Good luck.



Mostly rhetorical indeed. Because all the DirectX have a unified architecture and mechanisms, it is easy to bring your knowledge of one part to another. Do you think it is easiest to learn 6 different languages or to learn 5 dialects based on a well known language?


DworD


 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

to dword2002: you are so wrong! the point is:

the bad api interface design is not a must of COM.
they can "borrow" some idea, and make a "DirectGL"
but they didn't


quote:
Original post by dword2002

One thing is missing in this interesting article. Direct3D is not a stand alone GL.



you haven't even read the article, through.

btw: there's no such thing can make you learn-one-thing-and-do-the-other-thing, gl!



Edited by - ed9er on February 25, 2002 7:26:45 AM

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I think it's a good article.

I started 2 years ago with OpenGL but lately I started wondering if I shouldn't learn DirectX because I mostly want to program games.

This article clearly sayes that DirectX is nowadays the best for games. SO I think I'm going to learn DirectX and OpenGL, witch is the best solution.

 User Rating: 1046   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by ed9er
to dword2002: you are so wrong! the point is:
the bad api interface design is not a must of COM.


Wow… that’s quite a definitive argument: it is bad. Oh, I know what to answer: you are wrong, it is good!
quote:

they can "borrow" some idea, and make a "DirectGL"
but they didn't


What would have been the "technical reason"(sic) of a duplicated OpenGL?
quote:

you haven't even read the article, through.


I’m still impressed by such brilliant argumentation…

quote:

btw: there's no such thing can make you learn-one-thing-and-do-the-other-thing, gl!


Great. What do you think about this one : Claiming a thing is, does not make that thing exist.


DworD


Edited by - dword2002 on February 25, 2002 8:17:40 AM

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by dword2002
What would have been the "technical reason"(sic) of a duplicated OpenGL?



use COM, conform to the other part of DirectX
and provide a GOOD api interface

and please stop those non-thread-related (and brilliant) crap


 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

just incase this hasn't been brought up...


windows NT has a different naming convention for DirectX.

it is not, infact, 5 versions behind. It's more like 2.

 User Rating: 1024   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

As any one used directx 8.1 sdk with the appwizard for vc++? it rocks! I got a networked "teapot" up and running in less than one minute. It's only taken me 3 days to produce a tetris clone with multiplayer support and sound and music, with action mapping (which I like to use a gamepad with tetris)...I don't see opengl providing me that easyness with it self. Besides I can't stand using other people's libraries in opengl due to the fact that everybody uses a different standard of code, and I have to mix them.

-Pac
"The thing I like about friends in my classes is that they can't access my private members directly."
"When listening to some one tell about their problem (whether it's code or not), don't listen to what went right or wrong, but what they assumed....."

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by byrd
If ever (heh of course it will) a flameware starts again on this subject a link to this article ought to help extinguish it.


Yeah, like an article will stop the flamewars!

My opinion - use whatever you feel most comfortable with and let others do the same. It might be worth looking at what the majority of the industry uses for its games, as well as consider the sources of most of the people that are doing the flaming. How many of them are actually in the industry?

Breakaway Games

 User Rating: 1577   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

An unbiased article :-)

His first sentence on D3D was:
"Direct3D has drawn criticism from a number of sources."

His first sentence on OGL was:
"A lot of people like OpenGL, and for good reason."

Allthough I agree with most of what he said, a few points.

1. D3D is easily the "standard" Win32 game API. What's the percentage of games that use OGL that don't use the Quake engine. Had Carmack supported D3D, OGL would be long dead in the games industry.

2. The drivers for non nvidia cards are usually inferior for OGL.

3. Using D3D allows games to be ported to the X-Box easily, no consoles support OGL "out of the box" which means paying for licenses to use OGL.

4. Extensions don't just produce messy code (and it's really messy), they require the programmer to have each card he wants to write for as your effectively using each card's own API. This isn't just a final testing issue, but you actually need them during development ( otherwise your programming blind ).

5. D3D's method is better as they provide the functionality and then let the cards catch up. This means as new cards are released the game scales up to take advantage of the advanced features e.g. Vertex and Pixel Shaders.





 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by ed9er
use COM, conform to the other part of DirectX
and provide a GOOD api interface

and please stop those non-thread-related (and brilliant) crap



hmm. I lost in an abysm of perplexity. Anyway I'm sorry if I offended you in any way. That was not my goal. I just intend to give my arguments, not for or against (the love/hate debate would be a bit puerile, isn’t it?), but to try to completed what is said in this interesting article.
As Machaira said :
quote:

use whatever you feel most comfortable with and let others do the same.


I don’t want to convince anyone, as I don’t own any stock options nor in DirectX, neither in OpenGL.






 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I find it ridiculously funny that the response to an article written to quell the API flamewars has another brewing in it! dword2002 and ed9er, stop it.

And no more "rectally extracted" facts, okay?

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! ]
Thanks to Kylotan for the idea!


 User Rating: 2027   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

[DirectX] "Because of its focus on games, it's not well suited to high end graphics applications." ... What are you smoking?
I suspect that was a typo?

-------
Happy Coding!
Homepage: www.pcwebvia.f2s.com

 User Rating: 1014   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:

One error: Although I never used DirectX with C (only with C++), I'm pretty sure the C syntax for using it is like this:

D3DDevice->lpVtbl->DoSomething(D3DDevice, Params)// as opposed to what you wrote, which is this:D3DDevice->lpVtbl->DoSomething(Params)


Hmm, yeah I did forget to include the pointer after dereferencing the VTable. In any case, it's a minor error and has little to do with the content of the article; the point is made nonetheless. I'll let it slide by.

For the next couple of posts, I'll be honest. It looks to me like some biased ppl cannot deal with an unbiased article.

DworD, did you read the whole article? I say quite explicitly that the article is on Direct3D vs. OpenGL, not DirectX vs. OpenGL. I also note that DirectX provides other libraries, as well as noting several other libs, including SDL and OpenAL(thks Dave).

quote:

Original post by d9930380
1. D3D is easily the "standard" Win32 game API. What's the percentage of games that use OGL that don't use the Quake engine. Had Carmack supported D3D, OGL would be long dead in the games industry.


Did you look at the "Great Games" section? Notice that only one game didn't provide an OpenGL renderer, but one written by Microsoft...

quote:

3. Using D3D allows games to be ported to the X-Box easily, no consoles support OGL "out of the box" which means paying for licenses to use OGL.


PlayStation 2 does.

quote:

Original post by Wreakon
[DirectX] "Because of its focus on games, it's not well suited to high end graphics applications." ... What are you smoking?


That sentence didn't come out phrased exactly right, but the point stands. I challenge you to find one high end graphics app that recommends using the D3D renderer over the OpenGL renderer when both are working.

Anywayz, The article seems to be getting a good response, and I did spend a lot of time on it. I would like to prod the moderators a bit to add a link in the forum FAQs...

PS Oluseyi did YOU like the article? Because there is an opinion i cna really count on...



 User Rating: 1893   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

No offence promit but it was a biased document. You tried hard, but there are a few comments here and there that makes it seem aimed as a pro OGL article.

And also there are a few graphics programs out there that are only D3D (all free, done as side projects by people, but still count ).

 User Rating: 1034   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Now I have to say it was a noble attempt at covering a very heated topic, though the tone of the article still seemed a bit off. But as d9930380 pointed out, and as any English teacher will say, the first sentence sets the tone for what is to come. There is clearly a bias towards C and OpenGL.

Opinion Time:
I attribute some of the biased tone toward inexpeirence. It seems to me that the author's main expierience has been with C, possibly some Unix/Linux. This explains his attitude towards COM and how DirectX is tightly integrated with COM and Windows. With more expierence with C++, the author will understand more about the methodology behind COM as well as the syntax. DirectX is designed to be used in a C++ application. OpenGL, with its orgin in Unix/Linux, lends itself more towards C, because of the nature of Unix/Linux.

The author also, is a proponent of open standards, which again shows his bias towards OpenGL. Seeing Direct3D's closed nature as an weakness it clearly an opinion. Open Source and Open Standards definitely have their advantages, but software not build along these lines in not at a disadvantage. The author also shows his dislike for Microsoft in general, this again changes the tone of the article.

Now with OpenGL being the standard outside of the gaming world, we need to take a look at 3D software's past. When software programs like 3D Studio, AutoCad were orginally built, OpenGL was the only API available. The reason many of these still use it today is for that reason, the software was orignally built using OpenGL. By not re-writing the rendering engine, the developers behind these tools can focus more on new program features. Simple business practice, why fix what isn't broken.

I would like to see someone who has had worked with both APIs and been in the field take a stab at this article. I think a more seasoned developer would provide a more complete article.

-----------------------------
kevin@mayday-anime.com
http://games.mayday-anime.com

-- edit: spelling

Edited by - grasshopa55 on February 25, 2002 3:07:08 PM

 User Rating: 1019   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by Promit
Did you look at the "Great Games" section? Notice that only one game didn't provide an OpenGL renderer, but one written by Microsoft...


This can also be turned in the other direction, showing that you are biased toward OpenGL by presenting those titles.
quote:

3. Using D3D allows games to be ported to the X-Box easily, no consoles support OGL "out of the box" which means paying for licenses to use OGL.

PlayStation 2 does.


Not directly, but through a proprietary interface specifically for the PS2.
quote:

I challenge you to find one high end graphics app that recommends using the D3D renderer over the OpenGL renderer when both are working.


see my previous post
quote:

Anywayz, The article seems to be getting a good response, and I did spend a lot of time on it. I would like to prod the moderators a bit to add a link in the forum FAQs...


Let's wait on see on this one.



-----------------------------
kevin@mayday-anime.com
http://games.mayday-anime.com

 User Rating: 1019   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link
Page:   1 2 3 4 5 »»
All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: