OpenGL or Direct3D, again...

Started by
8 comments, last by The_Grand_User 15 years, 6 months ago
Sorry about asking this again I know it has been discussed several times before. Anyhow, since OpenGL 3.0 turned out to be such a disappointment, does this mean it could be better to start learning Direct3D, when learning one of them from scratch? Which one is better for small home projects, like small games, and which one could be better to learn for the future if you are to work with 3D programming? Now if you think I should learn both, then the question is which one I should learn first. Cross-platform isn't really important for me right now even though it would be nice. I've been reading around at some of the older threads and it seems like a lot have recommended OpenGL so I just want to check if the opinions have changed. Thanks in advance.
Advertisement
Quote:Original post by eXonius
Sorry about asking this again I know it has been discussed several times before. Anyhow, since OpenGL 3.0 turned out to be such a disappointment, does this mean it could be better to start learning Direct3D, when learning one of them from scratch?
Either will do fine.

Quote:Which one is better for small home projects, like small games,
XNA Game Studio.

Quote: and which one could be better to learn for the future if you are to work with 3D programming? Now if you think I should learn both, then the question is which one I should learn first.
Just pick one.

In the end, 3D programming concepts are the same, it's just 2 different APIs. It's like using printf or cout. They are different, but achieve the same thing. They both have functions that set up data to be fed to the GPU, and most of the advanced stuff is done in shaders anyways.

You should instead decide whether you will learn using the fixed pipeline or using shaders. HLSL and GLSL look nearly the same. The libraries functions of DX/OGL you call from C/C++/"anything else" might seems different, but it ends up sending the same instructions on the video card.
Quote:Original post by Daaark
XNA Game Studio.

Okay, I'll look into that also, though I just wonder if I'll learn as much from using this? Although my main goal is to learn as much as possible about 3D programming and the results aren't just as interesting.

Quote:In the end, 3D programming concepts are the same, it's just 2 different APIs. It's like using printf or cout. They are different, but achieve the same thing. They both have functions that set up data to be fed to the GPU, and most of the advanced stuff is done in shaders anyways.

But cout can be smarter than printf somethimes and I just wonder if it's the same with OpenGL and Direct3D.

Quote:You should instead decide whether you will learn using the fixed pipeline or using shaders.

Sorry but I don't really know what the difference is =/
Look at the following list of pros(good things) about each API and then just pick one based on what you think --->

DirectX
-------
- Has many APIs to do many things such as DirectSound for sound and Direct3D for 3D programming (there are many more APIs) but is restricted to just work for Windows.

OpenGL
------
- Is cross-platform but does not focus on anything but 3D programming.

Well this isn't really all of it but...
Quote:Original post by GuyWithNoAccent
Look at the following list of pros(good things) about each API and then just pick one based on what you think

Though this is more like a comparison between DirectX and OpenGL, for now I'm only interested about the differences of Direct3D and OpenGL (=
One way or another you will end up doing:
1. Creating window/associating gfx adaptor to a device with this window.
2. Filling up rasterizer states.
3. Filling up buffers (vertices, indices, etc).
4. Clearing the screen.
5. Setting up WVP matrices for each objects
6. Render each objects and go back to 2 or 4.

XNA kinda just hide some step that often comes to be set in the exact same way in all projects and give you some helper functions and methods to do your work faster, but allow you to have nearly the same results than you would get with the hard way.

The fixed pipeline (DX8, DX9 and OGL without shaders). Will render the object in the "normal" looking way. You can add lights (directional/points/spots) using libraries functions. The programmable pipeline (DX10 force you to use it) need and HLSL/GLSL/CG file who is a shader program to instruct your video card on HOW to render the primitive you send it. It allow you to do neat effects, you own lighting models, etc. It is becoming a industry standard, and I guess will be there for a while, but demand more work. DX11 will be strongly based on DX10.
I'm probably biased as I've been disgusted by the insane extension system of OpenGL ages ago (the time when 3dfx was still around). I had to get function pointers for.. uhm.. everything.. including multitexture functions.

I'd go for DirectX for several reasons:
1- you get "extra APIs" like xaudio2 or directsound
2- XNA is closer to DirectX, so if you decide to start with XNA it's probably better to continue later with DirectX. Or viceversa... who knows?
3- I never tried it but there's also SlimDX, a framework that can help you writing DirectX apps. If I'm not mistaken it's mantained by people writing here on gamedev.net.
4- DirectX SDK also includes an helper library, D3DX, which also includes useful math classes that can help you concentrate on the real thing.

On the other hand, OpenGL is simpler, probably the resulting code is cleaner, it's portable and you can learn the basic concepts of graphic programming without the need to worry about the underlying hardware architecture.

My experience is at first Direct3D seemed to me "crazy and bloated". Now I feel confortable with it and I think I'd have some problem writing code for an abstract API like OpenGL.

But again.. it's up to you, neither D3D nor OpenGL can hurt you. :)
If this is something you want us to vote on, I'd say Direct3D. PIX and PerfHUD are invaluable for me both in debugging and performance profiling. OpenGL's got gDEBugger, but it's not free and not as functional as PIX.

I like the Direct3D API to be cleaner than OpenGL's, and you don't need to do that much validation on device capabilities. I found the OpenGL extension jungle difficult for me, especially because nVidia and AMD don't really seem to agree on common extensions to support.

I've had more success writing code with better performance on Direct3D than OpenGL, but that's just based on my experience. Certainly you can work quite fast in both.

But anyhow, even if OpenGL 3.0 turned out to be a disappointment by some, that doesn't mean that the previous version of the API all of a sudden became any worse, right? If you're really tied on which one to use, try both for a slight while to see how common tasks work with them and then choose one based on your experience.
I've found that the documentation for Direct3D is better than the documentation for OpenGL, that's a big concern for a beginner.

This topic is closed to new replies.

Advertisement