Select a graphic device in windows + opengl

Go to Nvidia Control Panel > Manage 3d settings > select preferred graphics processor. By default you can see auto-select. Change it to your desired GPU.


The simplest solution is to paste this code snippet somewhere in your application. This will tell the Nvidia and AMD drivers to switch to the powerful GPU when your app starts.

// enable optimus!
extern "C" {
    _declspec(dllexport) DWORD NvOptimusEnablement = 1;
    _declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}

EDIT: add the AMD keyword


I am not 100% sure, but I seem to remember that under Windows this is not possible, other than to create a window on a specific screen.

NVidia provided an extension called WGL_NV_gpu_affinity. I'm not sure if this is still available and whether it works as you would like.

Edit:

I see that similar information is already provided in another thread, with an additonal link to this PDF. Not a satisfying answer perhaps, but at least some info.

Tags:

C++

Winapi

Opengl