Search code examples
openglsdlrendererpyopengl

GL_RENDERER: How do I change the renderer that my application uses?


I've seen the specs of my i5 notebook, and realized that it has two video adapters:

enter image description here

In my application, made with python SDL2 python and pyOpenGL, I put this line of code to know which renderer it's using:

print('Renderer:', GL.glGetString(GL.GL_RENDERER).decode("utf-8"))

And this is printed:

Renderer: Intel(R) HD Graphics 4000

I don't quite understand this issue of dedicated or integrated video card. So...

What should I do to use other renderer?


Solution

  • It depends on the operating system.

    On laptops with both an Intel integrated GPU and a separate AMD/NVIDIA GPU chip, the operating system decides which one to use. This is "Optimus" if you have an NVIDIA chip, "Dynamic Switchable Graphics" for AMD. By default a laptop OS will try to use the Intel GPU because that uses less power.

    Sometimes the OS will switch to the external GPU if it detects that your program is doing a lot of 3D stuff. On MS Windows there should be a control panel option somewhere to always use the external GPU if that's what you want. On Linux with NVIDIA and the special "Bumblebee" package (for Ubuntu anyway) you can choose which GPU when you run a program from the command line with a shell wrapper. On MacOS X or Linux with AMD, I don't know.

    If you want your program to decide which GPU to use without user intervention, you're going to have to write system-specific code to iterate over available devices/contexts/pixel formats.