OpenGL, SFML or DirectX?

Which way is better? I started learning DirectX about a month ago, but is this a bad idea? Or SFML is better, right?
Last edited on
I am unfamiliar with it, but I think that SFML renders only in 2D. If that's the case, this makes it way less versatile than OpenGL and DirectX -- that have the full capability to render in 3D.

After going over the features I saw in SFML's website, I think that it is probably superior to 2D APIs like SDL (I have only briefly used SDL about 4 years ago, but was surprised to find that there was no direct way to do 2D rotation, unless using SDL's OpenGL mode etc. ). SFML also has a lot of built-in compatibility for various file types and the features I read are impressive for a single package.

I think that OpenGL and DirectX are the most versatile -- especially if you want to render in 3D, in which case I think they're the only options.

As for OpenGL, it can be used in a cross-platform way although requires platform specific implementations of setting up your window, viewport, handling user input, playing sound etc -- since OpenGL does the rendering part only. You could use libraries like GLUT/OpenGLUT to set up system-independent window management and user input handling (GLUT is no longer maintained, but OpenGLUT retains the features of GLUT while expanding on them). For sound, I know that SDL was/is a choice sometimes made by OpenGL users, although that was a few years ago and do not know to what extent SFML could/might be a better supplement in the features it offers.

As for DirectX, it is system-dependent to Windows although involves components that are meant to handle other things than rendering alone -- like playing sound etc. .

You may be interested in this site:

It mainly has DirectX tutorials and code, but also has some material using OpenGL and dealing with the same subjects -- you could compare the code samples to see each API at work on a similar task.

Also, an interesting book I've found on comparative API use is David H. Eberly's "3D Game Engine Architecture". The author discusses an open-source 3D engine (the code can be found at that he wrote which runs on Windows, Linux and Macintosh. For Windows, it can use DirectX or OpenGL for the rendering (supports both), while for Linux and Mac it uses OpenGL. I think it's an interesting read.

Hope this helps you in some way Jackson Marie,

Last edited on
Thank you for pointing it out. Thank you so much!
Topic archived. No new replies allowed.