DirectX or OpenGL

Hi, I made few simple game using c# in Unity3d but I want to dig more in to game programming. And I'm not here to make my own engine, I want to make a game without using engine. My question is not about what is better between them, I know that I can do games what I want in either DirectX or OpenGL. My question is what should I learn first, like if I learn DirectX first, would it be easy to learn the OpenGL or the other way around. I prefer the one with good community for asking question or have an up to date tutorial online.
Personally, I use OpenGL. Which one you learn doesn't really matter, though, there are just a few things that you should have in mind. Firstly, OpenGL has much better compatibility than DirectX, as DirectX is windows-only while OpenGL is just a standard, and has thus been implemented cross-platform. However, from my forays into DirectX, they seem very similar, so it doesn't really matter. By way of documentation, DirectX has the MSDN website, while OpenGL has 'The Red Book', which can be found on the OpenGL website. I believe there is a forum there, too.

As for tutorials, I don't know any DirectX ones (I taught it to my self using the documentation on MSDN and my knowledge of OpenGL), but there is a very good modern OpenGL tutorial at http://www.arcsynthesis.org/gltut/ Also, it is fairly easy to learn one once you have learnt the other: As I mentioned, the concepts are the same, and they are both just API's. Really the only difficulty in learning them is getting your head around the linear mathematics that is required and little tricks for increasing efficiency or 'prettiness'.

Hope this helps!
Last edited on
@NT3 hi thank for the reply, and i decided to go on openGL and im confuse about glew, glut, glfw, glsl and etc. can you tell me what is good and what should i avoid using? i know there are tons of info in google but there are too many outdate threads that talking about this things and i dont know what to use or what is the best out of them. thanks again
OpenGL, outside of core functionality, is a mostly non-static library. Some functions might be there, some may not. The functions that vary are called "extensions" which aren't required to be part of core. To determine what is available and to actually load those functions, you use something like GLEW. GLEW is called the "GL Extensions Wrangler" since it queries OpenGL for what extensions it supports, loads any functionality that it can, and then exports them in a way that you can use OpenGL in a seemingly normal fashion. However, due to the nature of Windows, OpenGL functions are not statically exported from the platforms opengl32 (which may also be 64-bit which is stupid). So you have to load core functions dynamically as well, using wglLoadProcAddress... which actually requires a OpenGL context to first successfully load the functionality. It's rather confusing...

If the above confuses you, it get's a bit easier. GLUT, GLFW, and SDL are all libraries that allow you to avoid the above, with the exception of loading functions. So you will see people use GLEW and SDL in conjunction quite often. You use SDL/GLFW/SFML/GLUT to create a context, you use GLEW/glLoadGen to dynamically load the functions and to use OpenGL.

It's a lot easier to actually set a goal on what you want to accomplish, and learn by way of making that goal happen, then trying to learn everything at once.

What you should avoid using is the pre-OpenGL 3.2 functionality as its deprecated and tends to be slower. You should also avoid GLU which is deprecated and uses the fixed pipeline.

If you're confused on acronyms and terminology, well... join the club. I can define each acronym and explain in depth how each piece of software works and what it does in general detail, but that didn't happen over night.
Last edited on
I'll just give you a brief description of each one, and then give you my suggestions:
GLEW - The OpenGL Extension Wrangler, it is used to load the API's for 'modern' versions of OpenGL (i.e. >1.1).
GLUT - The OpenGL Utility Toolkit, it is used to create a basic window for drawing on simply and quickly, also providing minimum user interactions.
GLFW - Not entirely sure what it stands for, I think its the OpenGL FrameWork (could be wrong). It is similar to GLUT, though it is designed with games in mind and thus you have more control over the window, as well as better (IMO) methods for user interaction.
GLSL - OpenGL Shading Language, an add-on language from OpenGL 2.0 onwards.

Basically, my recommendation is GLFW is better than GLUT, though it takes a little bit more time to set up a window (not much, though, and nowhere near as much as resorting to the native API). As for other things, I would recommend getting the 'Unofficial OpenGL SDK', which contains various utilities that will help a lot with your development, such as glLoad which is an alternative to GLEW. Get it from http://glsdk.sourceforge.net/docs/html/index.html

Just another little thing, especially if you are using windows, you may need to update your drivers to be able to use modern versions of OpenGL. By default, Windows only supports OpenGL 1.1, while all modern graphics cards should support at least version 3.0, and high-level graphics cards should support 4.3.

If you don't understand anything here, don't worry, the arcsynthesis tutorial I linked you to goes through all of this in detail.
Topic archived. No new replies allowed.