Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've always been curious, how libraries such as DirectX, OpenGL and OpenAL are implemented. Do they use some sort of unified API provided by OS? Talk directly to kernel? Maybe hardware drivers provide unified API? Or vendors provide their own backends to such libraries? Even entire implementations of such libraries? Or such libraries handle different drivers on their own?

share|improve this question
up vote 5 down vote accepted

OpenGL is normally implemented by the hardware vendor, as part of their driver. On Windows, this is done as an ICD - Installable Client Driver. On Linux, it's often implemented as a backend driver for Mesa (an OpenGL-compatible library), but binary drivers like NVIDIA's usually have a custom-implemented On Mac, I believe it's built as a backend for Apple's OpenGL implementation.

DirectX is quite different: The software vendor (Microsoft) provides a unified driver API that the hardware vendor is expected to develop against, and a set of standards (WIHL, among others) that are expected to be followed.

OpenAL is an altogether different beast. Since it's only really written to provide hardware support for Creative Labs' own cards, there's really only the one hardware driver - all other sound cards use a software mixer implementation (of which there are a few different ones).

It's very rare for hardware drivers to implement their own unified API below OpenGL or something like OpenAL. The reason for this is that the specification leaves the matter of implementation completely open. DirectX essentially enforces a hardware API by its design, but this API is never exposed to userland software.

(As a side note, Mesa is having its guts replaced with Gallium3D, a unified API for hardware drivers, and Gallium3D is generalized enough that a complete DirectX 10/11 source-compatible library stack has been implemented on top of it. No hardware vendors to my knowledge offer Gallium-compatible drivers, and all of the existing drivers are based on the open source drivers already used by and Mesa.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.