4
$\begingroup$

The wiki says the following about using OpenGL on Linux:

Most Linux distributions rely on the Mesa3D project to provide their OpenGL implementation

But it also says:

OpenGL is included in drivers, so you'll have to make sure drivers are properly installed if you want to enjoy programs using OpenGL. Open source drivers actually make use of Mesa's OpenGL implementation.

So I am a little confused:

If I have an nVidia graphics card and install the nVidia drivers, do I need to install Mesa?

What if I have the card but do not install nVidia's drivers?

What, exactly, is meant by "implementation" in this context?

$\endgroup$
3
$\begingroup$

The Mesa3D project is a software implementation of OpenGL; that is, an implementation that does all the rendering on the CPU with no GPU involvement at all. It's designed in two layers: a backend which renders each frame from some internal state, and a frontend which implements the OpenGL API and sets up the state for the backend to use. Most OpenGL implementations have a similar two-layer architecture, so that the same backend can be used by an OpenGL frontend, an OpenCL frontend, a Direct3D frontend, etc.

The open-source NVidia drivers (and most open-source drivers) use Mesa's frontend to provide the OpenGL API and a backend specific to that GPU. The OpenGL API is quite complicated to implement, so it makes sense for vendors to share an existing front-end in this way. However, closed-source drivers do not use Mesa's frontend and have their own closed-source frontend.

If you install and use a closed-source GPU driver, it will include its own libgl, which doesn't use Mesa at all. You don't need to install anything else to run OpenGL applications. (You might need an extra "-dev" package to get the header files needed to compile OpenGL applications.)

If you install and use an open-source GPU driver, it will use Mesa, but the packages in your distribution should have the dependencies set up correctly, so that if an external Mesa package is needed, it will be installed automatically.

Either way, you shouldn't have to worry about whether the OpenGL implementation you're using is based on Mesa or not.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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