|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
| Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Direct3d vs OpenGL?
Hey everyone,
I am planning on making a 3d game soon. But I would like to know which is better to use. OpenGL is used for most games, but d3d seems cool too. Anyone know which is better? BTW, I am going to be using this with C++.
__________________
|
|
#2
|
|||
|
|||
|
"OpenGL is used for most games, but d3d seems cool too. Anyone know which is better?"
Neither. The question has been asked over and over and over in internet forums for a long while, and despite the endless discussion, no answer emerges. It's better to look at the facts and make a decision for yourself. Portability: DirectX is definitely Windows only. So for linux graphics, you must use OpenGL. Of course, a majority of apps and commercial games are made for Windows, so DirectX is incredibly popular. Packaging: OpenGL is graphics only. It does not come as part of a bigger system. Do you want sound? Networking? User input? You'll need to find other libraries to work with. Or frameworks or layers like SDL to work through. Direct3D on the other hand is part of DirectX. Once you want sound and all the other stuff that commonly comes with games, it's quite nice to just move over to a sibling library. Initial learning curve: I feel OpenGL has an edge over Direct3D for this. That's because DirectX involves COM. It's not a real pain if you're a competent C++ programmer, and if you have worked with COM before, the environment should be quite familiar. But the point is, initially OpenGL can feel a whole lot easier to start with. In the end, it makes no difference. Countless commercial games have been written to use OpenGL and the same for DirectX. Direct3D and OpenGL can accomplish the same things. Any game engine, framework, or something along those lines either supports both libraries or has a clone for the other one. Point is, pick one and stick with it. |
|
#3
|
||||
|
||||
|
Oler1s: Great post. I agree very strongly that its important to pick one and stick with it. In making your selection it is very important to consider which platform(s) you are wanting to develop for, like Oler1s said D3D limits you to one platform, where OpenGL works on Windows, Linux and Mac 10.x platforms.
To be completely honest I haven't worked with either one, however my colleagues that have all agree that OGL provides better documentation, better access to help and a more intuitive development environment. In short, if you are strictly developing for windows and you have familiarity w/ COM && || Microsoft DirectX API's in general then I would go the D3D route, if there is any chance at all that you are looking to port this to another platform in the future than I would save yourself some headache and use OpenGL from the get-go. -Nick |
|
#4
|
|||
|
|||
|
DirectX is purely Windows, so if your making a game only for windows, its good
![]() If you don't mind, I suppose its down to personal taste. Sorry if I've been a bit vague in this post, but I've had absolutely no experience in openGL and only a little in DirectX. Well I am only 15! |
|
#5
|
|||
|
|||
|
Up to you, I'm planning on learning Directx but I'll definitely get around to learning openGL too, you can never know too many API's
![]() Anyone who says one is better than the other is just fibbing to him/herself, the only real distinct clear advantage opengl has over directx is portability, thats about it, if you are developing for windows choose the one you want to get into more for whatever reason (which is why i recommend directx, easier for newbies thanks to microsoft )Last edited by dynamicVoidMain : March 9th, 2007 at 03:07 AM. |
|
#6
|
|||
|
|||
|
Actually... nowadays OGL support is better than D3d for the lower-end GPUs. And the plus of having multi-platform support, should give you a good idea of where to aim at.
Thing is... D3D might become cross-platform this year or the next one. But as I said, on lower-ends you wont have good support for this (and by support I also mean performance). |
|
#7
|
|||
|
|||
|
I have a quick question. How is OpenGL pronounced?
|
|
#8
|
||||
|
||||
|
hmm not sure
I always say "open" "G" "L"
__________________
Miscellaneous Software Viper_SB Developershed E-Support Anyone else play chess? Challenge me |
|
#9
|
|||
|
|||
|
Errr.... Okay. I dont think alot of people here have a clue about what they are talking about. The statement about OpenGL being used for more games is utterly wrong. Most games, very unfortunately, are written using DirectX... why do you think the Mac and Linux platforms have so much trouble with gaming. Its quite obvious if you ask me, because all (most) of the games use microshafts proprietary crap. Which lets them lock you into their platform.
Now, ignoring for a minute, the whole separate problem of portability. Direct3D and OpenGL are sort of similar, but I have found that by far, Direct3D seems to be much harder to understand to less advanced users although it does also particularly have a lot of helper functions that do some extra work for you. Where as in OpenGL you may not have those. But I find that in most cases OpenGL makes for much cleaner much more understandable code and is much simpler to understand for "beginner" users. |
|
#10
|
|||||
|
|||||
|
Quote:
Quote:
Quote:
It’s important that beginners understand the philosophies of the APIs. OpenGL presents a C-ish API. It works as a state machine. You make a number of calls to this machine to achieve what you want. It’s easy for beginners because the beginning logic is obvious. Everything is laid out sequentially. In addition, OpenGL takes care of some low level issues for you, that Dx doesn’t. DirectX involves COM. The API takes on an OO approach, or at least how COM does it. This makes it difficult initially for beginners, unless you happen to understand COM. If you don’t know how to think in an OO manner, and don’t understand how COM approaches it, it’s very difficult initially. Couple that with the additional resource management that DirectX expects of you, and you can see why initially OpenGL seems easier than DirectX. So clearly, in the end, it won’t matter. You’ll get over the beginner learning curve, which leaves you with two APIs that are just as powerful as one another. |
|
#11
|
||||||
|
||||||
|
Quote:
Certainly, the author of this topic said it in his or her initial post: Quote:
Quote:
Well considering the libraries that a very large majority of games use for other things, such as OpenAL and SDL which are already designed to be cross platform libraries, the ONLY thing holding them back is DirectX. |
|
#12
|
||||
|
||||
|
It's not that hard to do both, the api's are extremely similar (you can structure your game the same way). just create routines for each graphics library and to use a different one depending on the users settings.
Alot of games do both, it would take a little more effort but if you build your engine with a "wrapper" which will convert your commands into the according api commands for each type it shouldnt be a problem at all. for example in your code you could have something like DrawRect() with could be defined as (pseudo): Code:
DrawRect(x,y,attrib)
{
if(DirectXvar == 1)
{
//DirectX routine here
}
else {
//opengl routine here
}
}
}
You get the idea, by building wrappers for each of your instructions you can build an engine which can do both. If you want to do just the one though i'd go with DirectX unless your using a low level language. If your coding in C or assembly then i'd use openGL as it's easier to program in a procedural environment than DirectX. Last edited by calpol2004 : August 2nd, 2007 at 04:12 PM. |
|
#13
|
||||
|
||||
|
Recently I've started to step away from DirectX simply because of the lack of cross-platform compatibility. If you have the option to exploit multiple operating systems with one single API, why not?
GLUT and OpenGL are very powerful tools to use in game development and if a major game developer has used it successfully over the last decade, why not give it a shot? I'm not throwing DirectX out of the window but OpenGL seems like a wiser choice for me at the moment.
__________________
Regards, Eddy Luten. Information: C, C++, STL, Boost, OpenMP, Scriptionary, Google Book of the moment: Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, John M. Vlissides This post and all subsequent posts by "Thr3ddy" are licensed under the Creative Commons Attribution United States License 3.0: attribute "Eddy Luten" for any code used which was extracted from "Thr3ddy's" posts. |