Bob5421 Bob5421 - 3 years ago 146
C++ Question

Who runs OpenGL shaders if there is no video card

I am writing a very basic OpenGL C++ program (Linux 64 bits).

In fact, i have 3 programs:

  • a main C++ program

  • a vertex shader

  • a fragment shader

The 2 shaders are compiled at runtime. I suppose this programs are runs in parallel on video card by the GPU.

My question is what happens if my computer contains a very basic video cards with no GPU?

I have tried to run my program on VirtualBox with "3d acceleration" disabled and the program works!

Does that mean opengl detects the video card and run shaders on CPU automatically if there is no GPU?

Answer Source

OpenGL is just a standard, and that standard has different implementations. Normally, you'd rely on the implementation provided by your graphics driver, which is obviously going to be using the GPU.

However, most desktop Linux distros also include a software implementation of OpenGL, called Mesa, which is what get used if you don't have video drivers installed that support OpenGL. (It's very rare these days to find any video hardware, even integrated video on the CPU, that doesn't support OpenGL shaders, but on Linux drivers can be an issue and in you're case the VM is not making hardware acceleration available.)

So, the short answer is yes your shaders can run on the CPU, but that may or may not happen, and it may or may not be automatic, it depends on what video drivers (or other OpenGL implementation) you have installed.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download