Why are SDL and OpenGL related? Why are SDL and OpenGL related? c c

Why are SDL and OpenGL related?


SDL is a layer above OpenGL; in fact it uses GDI on Windows by default and also has a DirectX backend. People are probably saying you can use OpenGL to get around limitations of SDL on platforms that by default use OpenGL (ahem, Linux) because the higher level abstraction doesn't expose that functionality. However, then your code is "less" portable to Windows (or at least Windows using the GDI backend).

Also, SDL does a lot of other things besides graphics - audio, input, etc. that OpenGL doesn't do.


SDL is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, etc. It also supports 3D hardware via OpenGL.

OpenGL is a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics. The interface consists of over 250 different function calls which can be used to draw complex three-dimensional scenes from simple primitives. OpenGL was developed by Silicon Graphics Inc. (SGI) in 1992[4] and is widely used in CAD, virtual reality, scientific visualization, information visualization, and flight simulation. It is also used in video games, where it competes with Direct3D on Microsoft Windows platforms (see OpenGL vs. Direct3D).


SDL uses OpenGL as a hardware renderer for content that wants hardware rendering on some platforms. If you have such a platform, then OpenGL is the underlying API over which SDL is an abstraction.