# OpenGL OpenGL or Direct3D, again...

## Recommended Posts

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.

##### Share on other sites
Quote:
 Original post by eXoniusSorry 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.

##### Share on other sites
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.

##### Share on other sites
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 =/

##### Share on other sites
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...

##### Share on other sites
Quote:
 Original post by GuyWithNoAccentLook 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 (=

##### Share on other sites
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.

##### Share on other sites
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. :)

##### Share on other sites
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.

##### Share on other sites
I've found that the documentation for Direct3D is better than the documentation for OpenGL, that's a big concern for a beginner.

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627689
• Total Posts
2978659
• ### Similar Content

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.
• By dud3
How do we rotate the camera around x axis 360 degrees, without having the strange effect as in my video below?
Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.
Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.

References:
Code: https://pastebin.com/Hcshj3FQ
The video shows the difference between blender and my rotation:

• By Defend
I've had a Google around for this but haven't yet found some solid advice. There is a lot of "it depends", but I'm not sure on what.
My question is what's a good rule of thumb to follow when it comes to creating/using VBOs & VAOs? As in, when should I use multiple or when should I not? My understanding so far is that if I need a new VBO, then I need a new VAO. So when it comes to rendering multiple objects I can either:
* make lots of VAO/VBO pairs and flip through them to render different objects, or
* make one big VBO and jump around its memory to render different objects.
I also understand that if I need to render objects with different vertex attributes, then a new VAO is necessary in this case.
If that "it depends" really is quite variable, what's best for a beginner with OpenGL, assuming that better approaches can be learnt later with better understanding?

• 18
• 14
• 12
• 10
• 12