Sign in to follow this  
HebrewHammer

OpenGL....Direct3D?

Recommended Posts

HebrewHammer    122
I've just started getting inot to game programming and I'm current;y learning C++ and then Plan to learn DirectX (I plan on programming Multiplayer FPS, i.e. CS). Then I saw a book on OpenGL. What are the differences between OpenGL and Direct3D? Any advantages? Thanx

Share this post


Link to post
Share on other sites
Boku San    428
8) The infamous "this" vs. "that" threads are considered flame bait. If you’re debating between OpenGL and DirectX or C vs. C++, please try to refrain from creating "which one should I choose" or "which one is better" threads. These threads usually turn into an argument and rarely lead to any kind of conclusion.
The best way to find out if something is right for you, is to try it for yourself or at the very least, spend some time researching the pros and cons.

Forum FAQ.

'Tis not an issue we speak of. Differences are on google. OpenGL is in C, Direct3D is in C++.

The difference is more or less negligible. Choose one, learn it. If you don't like it, concepts of one will help you to learn the other.

Share this post


Link to post
Share on other sites
HebrewHammer    122
Sorry, how i worded it was really not the way i meant it. I was wondering if they did the same thing? Like, i know that Direct3D is for Graphics and is used in alot of games. I just dont know alot about OpenGL. But since you said the OpenGL is in C, it is not an option for me, seeing how i have to use c++. Thanx

Share this post


Link to post
Share on other sites
Boku San    428
C++ is built on top of C; OpenGL is very much an option.

Direct3D and OpenGL are both APIs for 3D Graphics. Their usage and syntax are slightly different, but descriptive names and widely-available documentation make them very readable and easy to learn.

But do what you want.

Share this post


Link to post
Share on other sites
CoderGuy    130
You can use C++ in OpenGL. You can use other languages as well. OpenGL is cross platfrom while DirectX is Windows only. OpenGL is graphics only, but you can use SDL and other things to read from the keyboard, etc.

Share this post


Link to post
Share on other sites
Rayno    511
They are used for the same thing. Though "DirectX" includes other libraries for doing things like sound and input. OpenGL is just graphics.

You should also note that you can almost always use C code with C++, since C is (for the most part) a subset of C++. In fact, I bet someone out there has already written a C++ interface for OpenGL.

Share this post


Link to post
Share on other sites
BTierens    124
It all depends on what you want to do. If you are writing a cross-platform game, you will have to use OpenGL. If your game is Windows-only and you want to use audio, networking, joystick,... you could choose DirectX as it is an api that has functions for all these things.

My opinion is that OpenGL is more simple for a beginner.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Quote:
OpenGL is also slightly faster than DirectX.
sorry, but i don't agree with that. neither one is automatically faster. it depends very much on the card and the driver. for instance, nvidias implementation of opengl is faster than ati's.

Share this post


Link to post
Share on other sites
Protocol_0    100
Quote:
Original post by Anonymous Poster
Quote:
OpenGL is also slightly faster than DirectX.
sorry, but i don't agree with that. neither one is automatically faster. it depends very much on the card and the driver. for instance, nvidias implementation of opengl is faster than ati's.

OpenGL's state machine is faster than DirectX's Object Oriented Design. Generically, not specifically.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
OpenGL is not supported by Microsoft. In facts, Microsoft is searching since years to kick OpenGL from their platforms. This is a really annoying and dumb attitude from Microsoft, but be ready: we have OpenGL 2.0 now, but on Windows only OpenGL 1.1 (and with the new Longhorn they will move to OpenGL 1.2...). Thanks Microsoft, you make me moving to linux easier and nicer...

Share this post


Link to post
Share on other sites
MichaelT    214
Let's say for arguments sake that MS would drop OpenGL entirely (which they won't as they've already publicly stated that they will continue support. Infact they have staff that only deals with OpenGL) doesn't mean you can't still use OpenGL on windows. Drivers and SDK's will still be provided by the Graphics card manufacturers. Naturally it would be preferred that MS would support OpenGL 2.0 but that is really only on SDK level since MS doesn't write the SDKs, nor do they set the standard. I can fully understand the business notion behind them not wanting to support a standard that is in direct competition with their own.

Anyway, MS can't make OpenGL go away. After all, it is an industry & academic standard and they know it.

Share this post


Link to post
Share on other sites
Protocol_0    100
Quote:
Original post by MichaelT
Let's say for arguments sake that MS would drop OpenGL entirely (which they won't as they've already publicly stated that they will continue support. Infact they have staff that only deals with OpenGL) doesn't mean you can't still use OpenGL on windows. Drivers and SDK's will still be provided by the Graphics card manufacturers. Naturally it would be preferred that MS would support OpenGL 2.0 but that is really only on SDK level since MS doesn't write the SDKs, nor do they set the standard. I can fully understand the business notion behind them not wanting to support a standard that is in direct competition with their own.

Anyway, MS can't make OpenGL go away. After all, it is an industry & academic standard and they know it.

Agreed. If Microsoft could stop OpenGL being installed on windows, than they could stop the spreading of viruses. They have no control over it.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Quote:
Original post by MichaelT
Infact they have staff that only deals with OpenGL


Ehm, can I know what did this staff the past 5 years? I *HOPE* that graphic card developers will directly get OpenGL under their cares, because a 5 year old OpenGL 1.1 version is by far not the future... I can't believe that a staff existed until now for OpenGL under Windows: what the hell they did????

Share this post


Link to post
Share on other sites
bobason456    156
This may sound dumb but what are the chances that some smart kids could implement openGL 2 on Windows, with out Microsoft getting involved.. or is that just wishful thinking?

Share this post


Link to post
Share on other sites
kusma    170
It's not my intention to go into a flame-war, but i would like to clarify some things. First of all, there is never "Oh, Direct3D is better than OpenGL". Nor is it the oposite. What API is best suit for a project is a project-specific thing. Some projects might have better use of the ease of porting to systems like MacOS X or Linux that OpenGL give, while some benefit from Xbox-support or the generally better driver-support with lowend hardware that Direct3D bring to the table.

Besides, on large projects, the actual rendering-code is really not a big deal. So you could write a GL-renderer AND a D3D-renderer. If you mix personal feelings or politics into this, you are only making things worse for your self by eliminating good tools.

Quote:

OpenGL has an ARB (Architecture Review Board) with 9 different companies involved. DirectX is just Microsoft. This would mean that OpenGL has more input into how we can improve it for the future.


So, you really believe that microsoft make D3D without any input from the hardware vendors? Let me tell you, you are dead wrong here ;) Microsoft has a good cooperation with the major hardware-vendors, and every new DirectX-version is based on the feature-set of the upcoming hardware.

Quote:

OpenGL is also slightly faster than DirectX.


With nvidia, maybe. With intel extreme graphics, not at all. And in the end, it all comes down to what you're doing. In GL, you are allowed to do more "stupid" things for convinience, like glBegin/gEnd.

Sure, I might sound D3D-biased here, and perhaps I am. But I DO use GL when I see obvious advantages. The point of my rant here is that it's all about choosing the tool that covers your needs. It's not religion.

Share this post


Link to post
Share on other sites
_the_phantom_    11250
The only time that OpenGL is faster than D3D is when it comes to vertex array data submission, where OpenGL can be between 2.3 (10 triangles per batch) and 1.7 (200 triangles per batch) times faster (source: D3DTutorial3_Pipeline_performance.pdf I cant find a link to it any more), however this isnt really a killer choice wise however and is down to the differences between OGL and D3D at the driver level.

Also I wouldnt called glBegin()/glEnd() "stupid" as such, if applied in the wrong situation then yes they are stupid, however they are usefull for some things where you have a very low number of vertices and the overhead of setting up a buffer and drawing is greater than just drawing directly.

But other than those points, yes, pick the tool which works for you, if you are just starting out then try a little of both and see what you like, you can always swap later if needs be.

Share this post


Link to post
Share on other sites
kusma    170
Quote:

Also I wouldnt called glBegin()/glEnd() "stupid" as such, if applied in the wrong situation then yes they are stupid, however they are usefull for some things where you have a very low number of vertices and the overhead of setting up a buffer and drawing is greater than just drawing directly.


that's why i used quotation-marks ;)

Share this post


Link to post
Share on other sites
Promit    13246
Evrery time I read one of these threads, it makes me want to bang my head on the table. So much misinformation here.

Quote:
OpenGL's state machine is faster than DirectX's Object Oriented Design. Generically, not specifically.

How does this even make sense? D3D and OGL are both state machines, and neither of their layouts is inherently faster than the other.

Quote:
OpenGL has an ARB (Architecture Review Board) with 9 different companies involved. DirectX is just Microsoft. This would mean that OpenGL has more input into how we can improve it for the future.

To take the second sentence first, "we" have no input at all into the development of OGL. IHVs (nVidia and ATI in particular) are the controlling entities, with some major software companies such as SGI having some say as well. Game developers can talk to NV/ATI about what they want, but there isn't any direct input to the ARB. Second, Microsoft isn't working in a vacuum. They are talking to IHVs and ISVs constantly about what is desired from D3D. The crucial difference is that MS can have the final say and more or less force the other companies to accept their point of view. This is not necessarily a good or bad thing.

Next -- the stuff about only GL 1.1 being supported on Windows. Yes, but not really, no. GL is laid out something like this. The root entry point for any application is opengl32.dll. However, opengl32.dll does not do anything! It's merely a central access point for all apps. It will dispatch to a driver dll provided by the video card drivers. These driver dlls are fully featured. The root opengl32.dll only exports a GL 1.1 interface. However, you can request function pointers to any of the functions through GL 2.0, and since those requests are dispatched out to the driver specific DLL, you'll get a function pointer back for it. Most GL extension loaders/managers (I recommend GLee) can make this process transparent, so that you can do a check for the currently supported OpenGL version and begin using the functions for that version as if they weren't extensions at all.

Indeed, the only difference of any note at all between the core D3D and OGL APIs is what _the_phantom_ mentioned about GL coping better with small batch sizes. (D3D has, however, introduced a technique called instancing to combat this.) But, I emphasize the word core for a reason. There's a lot more to OpenGL vs Direct3D than OpenGL and Direct3D. D3DX, for example. Or any of the various libraries for OpenGL. But to leave that aside, and to give my usual closing advice:
Quote:

Just pick whichever API looks more appealing to you, and go for it.

Share this post


Link to post
Share on other sites
Oluseyi    2103
Quote:
Original post by bobason456
This may sound dumb but what are the chances that some smart kids could implement openGL 2 on Windows, with out Microsoft getting involved.. or is that just wishful thinking?
I believe Microsoft has indicated native OpenGL 2.0 support for Longhorn.

Then again, that's if and when we finally see Longhorn. [smile]

Share this post


Link to post
Share on other sites
TheOther    150
Quote:
Original post by Oluseyi
Quote:
Original post by bobason456
This may sound dumb but what are the chances that some smart kids could implement openGL 2 on Windows, with out Microsoft getting involved.. or is that just wishful thinking?
I believe Microsoft has indicated native OpenGL 2.0 support for Longhorn.

Then again, that's if and when we finally see Longhorn. [smile]


This article only quotes support at the 1.4 spec..:(

http://www.extremetech.com/article2/0,1558,1791683,00.asp

I agree with the early post about using the right tool for the right job. Sometimes OpenGL is preferred, sometimes DirectX/3D...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this