Sign in to follow this  
furnace

Shall I become a DirectX or OpenGL beginner?

Recommended Posts

I wrote quite a long post initially, but here's a short version saying exactly what I want to say, just without the blah! - I have an idea for a game that only I will probably ever play, and will be developed for Windows. - It will be my first game. - My job is in application and internet development and I know enough to be confident that I can actually do this. - I already know very basic OpenGL, e.g. I can draw triangles and move them. - I don't know any DirectX. - I don't want to learn OpenGL if DirectX is "miles ahead" or OpenGL is not "worth" learning for any reason. - I'm worried about DirectX keeping me bound to Windows, but in reality, I'll only ever write a Windows game anyway, and the only console I own is an xbox 360. So, what do you think... Do I build on the very basics I've already learnt in OpenGL, or do I start again and learn Direct3D/DirectX? Thanks for your opinions!

Share this post


Link to post
Share on other sites
Work with what you're most comfortable

If, in the future you decide to change - the skillsets are transferable
The 2 apis actually have alot in common
As for abilities & "features" - they don't arrise until you get much, much deeper
Capabilities are still pretty much equal for both

But don't worry too much, from the onset
Get stuff done first :]

Share this post


Link to post
Share on other sites
Quote:
Original post by furnace
I wrote quite a long post initially, but here's a short version saying exactly what I want to say, just without the blah!

:)

I'd say, stick to OpenGL. Especially for a first game, any differences in capabilities are not going to hinder you anyway (simplistically said, if one is capable of pushing 10.000 poly's and the other 100.000, does it matter if your game only needs 1.000?).


But actually, OpenGL is probably too low-level if you just want to get a game done. Take a look at SDL, Allegro or Haaf's Game Engine. Much of the core functionality that most games need is readily available in the form of frameworks and engines, so pick one that's suitable and go with it. Hey, I've even seen some great games built with Gamemaker, and personally, I prototype a lot in Flash and also Python. It's relatively quick and easy to work with so I go with it. :)

Share this post


Link to post
Share on other sites
To allay any fears about performance in OpenGL - This is no magical difference in performance between the two
They will both perform as fast as one-another if they are fundamentally doing the same thing

Speed differences only occur when you start to make use of more advanced features, designed to optimise performance for specific scenarios
(Both gl & d3d have slightly different approaches when it comes to some of this features, but there is no clear decider)

Either one is as good as the other

But what Captain P said @ the end also holds true - Whatever is fastest & easiest for you to develop in should be your choice - weather this be direct gl, or a high level api

Share this post


Link to post
Share on other sites
I personally like DirectX because that's the one I originally learned to use. But, now I'm wondering if OpenGL would be just as good. Does anyone know if OpenGL is used in any major games on the market?

Share this post


Link to post
Share on other sites
DirectX is not "miles ahead" of OpenGL, just get updated more often. As others said, they do the same things with the same performance except for advanced concepts you shouldn't bother yet. You shouldn't become a DirectX OR an OpenGL programmer, you should know both. Anyway, once you know one it's pretty much the same thing for the other or any API you can find.

OpenGL often get points for being multiplatform unlike Microsoft who own all rights on DirectX, but as you said you, and most people, won't ever want to program a game on any other platform than Windows and x360 anyway.

Share this post


Link to post
Share on other sites
You have an interesting conundrum on your hands. The real question you should be asking yourself here is "What do I want to do with my knowledge after?"

It's been said here and in many other places OpenGL has been rapidly losing the 3D API wars for some time now and will probably continue to do so in the future. As such, it makes little sense to invest a lot of time and effort into using a system with a limited future ahead of it. Hell, John Carmack himself has really abandoned ship with id Tech 5.

So basically if you're interested in really taking your newfound ability somewhere, (i.e. doing this more later) go DirectX. If you're just interested in messing around with your one pet project, stick with OpenGL.

With all this being said, I'm a huge DirectX fanboy and that's what my personal recommendation's going to be. In all honesty OpenGL's really not even designed for taking full advantage of current 3D architectures and paradigms.

Share this post


Link to post
Share on other sites
You shall not become an OpenGL nor a DirectX beginner, you shall become a 3D beginner.

Whether you use OpenGL and DirectX matters little. OpenGL is just more low-level; DirectX will try to do everything for you.
It might be better to work with OpenGL if you want to gain a better understanding of 3D.

OpenGL might not allow you to make optimal use of the graphics card in all cases, but anyway heterogeneous development over both the CPU and the GPU is a difficult subject.
You may also want to look into a GPGPU solution as an alternative to resorting to another 3D graphics API when what you would like to do is not made available by OpenGL.

The algorithms are what is really important after all, and be them executed on the CPU or on the GPU through a graphics API matters little when you're learning them.

Share this post


Link to post
Share on other sites
From experience using both APIs quite frequently, it really doesn't matter which one you choose. Once you're comfortable with either one you'll be able to pick up the other and hop back-and-forth easily.

I'm inclined to suggest that you stick with OpenGL so that you can get a grip on the concepts without having to start all over again. Then when you inevitably work on a DirectX project it will be simple to look in the docs and ask "How do I do what I was doing in OpenGL, but in DirectX?".

On the other hand, if you feel like it then by all means feel free to take DirectX instead. It's actually a very short-term decision, not a lifelong commitment, even though it may seem that way at first.

Either way, here are some suggestions to make the learning process easier:

-The biggest and most complicated part of either API is the fixed function pipeline. I recommend that you ignore it completely - the programmable pipeline is better and easier, and hardware support is pretty much ubiquitous these days.

-Learn how to write vertex and pixel shaders (easy if you keep it simple - BTW in OpenGL these are referred to as vertex and fragment programs), and draw batches of polygons using those shaders. Then throw in textures and maybe render targets and that's pretty much all the tools you need from the API to do some amazing graphics. Simple, isn't it?

-Is window-handling or other menial code distracting you from what you're actually focusing on learning? Just use SDL and it will all be taken care of for you. Works with DirectX, OpenGL, or even just by itself.

-If you want access to the latest OpenGL features, you can use a library such as GLEE. (alternatively there as the GLEW library, which does the same thing but gives you a bit more control). With DirectX you can access new API features by upgrading your DirectX API.

Share this post


Link to post
Share on other sites
Why not have both?

You can use for example Ogre3D rendering engine ( http://www.ogre3d.org/ ). It abstracts the choice between DirectX and OpenGL away from you. You don't need to write any DirectX or OpenGL code if you use it. It has been written already by pro 3D programmers.

Porting your game to other platforms becomes much easier if you use it.

There are also *game* engines which use Ogre3D, free and commercial.

Head over to http://www.ogre3d.org/ and start reading.

Share this post


Link to post
Share on other sites
Since you have already started with OpenGL, stick with that. The API is nothing but a tool. Work on learning the concepts instead and apply them in projects you find interesting. At times you will find yourself overwhelmed but you just have to persevere - the results will be extremely rewarding! :)

A word of advice: there are simply too many APIs, engines and libraries to choose from. Everyone will have a personal preference and it is very easily to get lost in the choices (all of us have suffered from this one time or another). The solution? Start simple and stay focused.

To sum it up, stick with OpenGL. You will know when it will be time to move on.

Share this post


Link to post
Share on other sites
Quote:
Original post by Neptune
I personally like DirectX because that's the one I originally learned to use. But, now I'm wondering if OpenGL would be just as good. Does anyone know if OpenGL is used in any major games on the market?


A: yes, ID's Quake series.

Share this post


Link to post
Share on other sites
Quote:
Original post by Captain P
Quote:
Original post by furnace
I wrote quite a long post initially, but here's a short version saying exactly what I want to say, just without the blah!

:)

I'd say, stick to OpenGL. Especially for a first game, any differences in capabilities are not going to hinder you anyway (simplistically said, if one is capable of pushing 10.000 poly's and the other 100.000, does it matter if your game only needs 1.000?).


But actually, OpenGL is probably too low-level if you just want to get a game done. Take a look at SDL, Allegro or Haaf's Game Engine. Much of the core functionality that most games need is readily available in the form of frameworks and engines, so pick one that's suitable and go with it. Hey, I've even seen some great games built with Gamemaker, and personally, I prototype a lot in Flash and also Python. It's relatively quick and easy to work with so I go with it. :)

Yeah I was going to suggest something similar. Using XNA since he'd be able to easily recompile his game for his Xbox if he wanted using XNA. Actually, with XNA 3.0 now you can also make the game for Zune too now!


Share this post


Link to post
Share on other sites
Quote:
Original post by furnace
- I have an idea for a game that only I will probably ever play, and will be developed for Windows.


I write/make stuff for myself (on games like StarCraft) all the time. Programming (C specifically) and "map editors" (I also build them, like ID Software's Commander Keen: Marooned on Mars, 1991).

I think it's very cool, and interesting that you'd say that right off the bat.

Quote:
Original post by furnace
- It will be my first game.


I hope you enjoy it and are proud of yourself in that case; My first "game" was textual 100%. Sort of like Snake (using the window's console, which can be ported to Linux with ease).

Quote:
Original post by furnace
- My job is in application and internet development and I know enough to be confident that I can actually do this.


Your job is in "Application and Internet Development?" Which means you program HTML, Java, MySQL (scripts and variations thereof)?

Quote:
Original post by furnace
- I already know very basic OpenGL, e.g. I can draw triangles and move them.


I bought "The OpenGL Superbible" in 1996? when the man wrote it. It is very descriptive (I also have his second edition, was quite interested when he made the third). If you were really interested in learning OpenGL, I'd suggest that book.

I also know OpenGL; Not the worlds most advanced concepts and usages but, I know enough to entertain myself with 2D games (I'm a personal fan of 2D and believe *most* 3D games that just use the same "game engine" are of a lacking interest).

Quote:
Original post by furnace
- I don't know any DirectX.


Learning DirectX is very! Easy! DirectX requires you know (the worlds most *basic* Win32 knowledge. AKA "CreateWindow" function call and you're done).

Quote:
Original post by furnace
- I don't want to learn OpenGL if DirectX is "miles ahead" or OpenGL is not "worth" learning for any reason.


OpenGL has a long history, and alot of variations. It is an OPEN SOURCE language. You can feel free to modify, update, change, and share it - This means *anybody* or a group thereof can modify it and better it (if needed).

DirectX was released in 1995 and has been being updated ever since. The "X-Box" (originally called DirectX Box, was code named "X-Box" and it stuck) is based purely on DirectX, and was probably DirectX's first (and personally, only) feat in the 3D-graphics world.

OpenGL and DirectX are what, most people, would call "evenly matched."

Here's an example of that question (slightly changed from API to language):
Which is faster? Assembly or C?

The answer: Assembly.
Now which can be produced faster? C of course (all depending on what you're doing).

Assembly gives you alot more control (as does OpenGL), due to the simple fact that it is a lower-level language. Which more control comes more "responsability" of doing stuff and taking care of stuff. DirectX is more abstract (general) than OpenGL and "takes care of" stuff for you, but with that you lose control over how it is does (internally and what-not).

The performance may suffer, but with the sheer processing power of todays computers, it is insignificant - For games like America's Army, Spore, World of WarCraft (resource sucking & demanding games), the end-toll might be 5 FPS difference which doesn't really matter because the average human brain only sees 60 FPS (registering and what-not). You might see it herk and jerk if it's running at 25 FPS and drops to 20 FPS for a moment (you exited a building and the land had to load in the distance with "fog").

Quote:
Original post by furnace
- I'm worried about DirectX keeping me bound to Windows, but in reality, I'll only ever write a Windows game anyway, and the only console I own is an xbox 360.


Switching from high-level language to high-level language is basically the same thing, all the syntax is about the same, all the commands are very similar (although there is always a unique attribute here and there).

OpenGL is cross-platform compatible, while DirectX (obviously) is Windows only. If you're planning on trying out other operating systems (or have friends who use them) you might want to look at OpenGL.

But in the end, I personally believe you should learn (at minimal) the basics! Of both APIs.

Quote:
Original post by furnace
So, what do you think...

Do I build on the very basics I've already learnt in OpenGL, or do I start again and learn Direct3D/DirectX?

Thanks for your opinions!


I think you should (at first) persue OpenGL and finish your "Windows-only" game (and assuming you write it in OpenGL, you can show all your friends!!) then learn DirectX a little-bit, and make a decision of which you prefer, or like better.

Finally but not least: I wrote all of that because I don't believe people should make a single lined post (especially! When 14 other people have done it before, joining band-wagons accomplishes nothing, other than creating a false-sense of "peer-pressure"), if you have something to say, say it!

Share this post


Link to post
Share on other sites
Quote:
It's been said here and in many other places OpenGL has been rapidly losing the 3D API wars for some time now and will probably continue to do so in the future. As such, it makes little sense to invest a lot of time and effort into using a system with a limited future ahead of it. Hell, John Carmack himself has really abandoned ship with id Tech 5.

incorrect, id tech 5 is still solely using opengl on the pc

the future of opengl is better now than it was say 3 years ago

A/ google etc use ogl (exclusively I believe)
btw heres a new app I saw today on the news http://news.bbc.co.uk/1/hi/technology/7725560.stm
I wouldnt be surprised if the number of hours spent on this and other similar stuff eg google earth (400million downloads btw, what game even comes close to that) top the number of hours playing games

B/ apple uses opengl exclusively, apples marketshare has been growing far greater than normal? pc stuff

C/ all iphones + new ipods use opengl for the 3d rendering

Share this post


Link to post
Share on other sites
Thanks for the great response everyone :)

I've read through all of your replies (I was suprised to have so many good responses). I think, as I know something about it already, I will continue playing with OpenGL and get more comfortable with that. It's reassuring to hear that similar theories apply to both APIs so I needn't worry too much about wasting time learning either one of them.

It's interesting that Ogre3D was mentioned as I have skimmed over the manual of that already. But I think I would like to play directly with the APIs before using any kind of abstraction.

@MuTeD - I wouldn't start with HTML, I hate it when people call that programming! But yeah I'm paid to use PHP, MySQL, VB.Net and the inevitable follow-ons from that (html, javascript, ajax, bits of C#, and so on). I also have two evening course qualifications in C++ and one in VB.Net all at Distinction level, and a software development diploma (which is worthless really, anyone could have passed the diploma). I've written various applications in both spare time and work time, but never a game.

Thanks again to all of you for your replies. I'm sure I will keep you updated when I learn new things and come across new problems!

Share this post


Link to post
Share on other sites
Quote:
Original post by MuTeD
Finally but not least: I wrote all of that because I don't believe people should make a single lined post (especially! When 14 other people have done it before, joining band-wagons accomplishes nothing, other than creating a false-sense of "peer-pressure"), if you have something to say, say it!

While I empathize with wanting to help, all those lines you felt you needed to say were for the most part, completely incorrect - no offense! I only bring it up because you may have confused the OP.

To touch a few points:
- OpenGL is not OPEN SOURCE, it is an open standard. You can not, normally, get the "source code" to an opengl implementation, as there will most likely be a different implementation on every different piece of hardware.
- DirectX vs. OpenGL = C vs Assembly is wrong in so many ways.
--- C is not "faster" than assembly. One can make an assembly program that runs slower than its C equivalent - quite easily these days what with pipelining concerns etc...
--- OpenGL is not faster than DirectX. In fact the paths taken in DirectX can sometimes yield better results than the equivalent logic worked out in the way you would in OpenGL. This doesn't necessarly mean DirectX is "faster" than OpenGL either. They are just two APIs for accessing graphics hardware.

Anyway, furnace, if you think that only you will ever play the game, why not go for something like Ogre or another higher-level abstraction so that you can whip that game out faster. I doubt that you will find yourself limited, and it will probably do whatever you are aiming for better than you would be able to do it (at least on your first few attempts), and will save you loads of time. Although I understand, as I'm a pretty stubborn person and have only recently warmed up to "other people's" code.

Either way, have fun and good luck!

Cheers
-Scott

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