Reputation: 7176
I know how to open a window with openGL (using Win32 or other toolkits). But when the system have 2 graphics cards. How do I select a graphic device to render? My programming language is C++ and I'm focusing on windows but any sample will be welcome.
Edit: Maybe Its a good idea to explain my problem better, in order to add some perspective: My new laptop have two graphic cards. An integrated Intel HD and a GeForce GT 540M. The intel card works most of the time to render SO, because it save battery. When a game is started, then the GeForce is started automatically. This system is called "optimus" by nvidia ( http://www.nvidia.com/object/optimus_technology.html ). The problem is that when I start my application, de opengl driver detected is 2.1 and the vendor is Intel, and I don't know how to switch to the other device.
Finally I found this information. It isn't too useful if you are not using nvidia but I let it to any who could read http://developer.download.nvidia.com/compute/cuda/3_2/toolkit/docs/CUDA_Developer_Guide_for_Optimus_Platforms.pdf
Upvotes: 19
Views: 21104
Reputation: 824
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
Upvotes: 26
Reputation: 20030
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.
Upvotes: 10
Reputation: 123
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.
Upvotes: 2
Reputation: 11
you should use WGL_NV_gpu_affinity extension to programming with multiple GPUs with OpenGL. (in case, NVIDIA card). But it is only supported on QUADRO series. So unfortunately you can't select rendering graphic card on your system.
Upvotes: 1