PDA

View Full Version : Selecting specific render device



Taicoon
10-28-2010, 01:03 AM
This ought to be a basic question but I have been unable to find any details anywhere. Perhaps someone here can direct me.

On a system with a very basic first device and a potent secondary device I need to select to create my contexts on the secondary device. After setting a PIXELFORMATDESCRIPTOR and looking for formats I get one which is supported... by the basic device.

That device does however not support the various extensions that I need and it, so I need to somehow select the secondary device by some other means than the pixelFormat. Both devices support my pixelformat.

With directx this is as simple as giving a device index of 1 rather than 0, but with opengl, how is it done here?

Alfonse Reinheart
10-28-2010, 03:50 AM
but with opengl, how is it done here?

It isn't. If you have two OpenGL capable devices, the ICD model basically picks one of them arbitrarily. I would guess it would be the first one that was installed, but there's no way to know.

In short, the Windows OpenGL ICD only allows you to use one device. How it picks it is unknown.

Chris244
10-28-2010, 06:09 AM
Theoretically the DC passed to wgl functions can be used to select the device.

I had limited success doing this on XP (though I remember running into video driver bugs in some cases). Assuming that your device is connected to the desktop, position your window on a display of the appropriate device then GetDC from that window. The window doesn't need to be visible if you only need to do offscreen rendering. If the device isn't attached to the desktop, CreateDC would be the only choice to get a DC. I can't remember how well that worked.

I had less luck on Windows 7. I always got the device associated with the primary display.

I believe Microsoft controls the algorithm that is used to select the ICD that is used.

If you know that the devices are from a single vendor, you could try a vendor extension:
http://www.opengl.org/registry/specs/NV/gpu_affinity.txt
http://www.opengl.org/registry/specs/AMD/wgl_gpu_association.txt

Taicoon
10-30-2010, 08:59 AM
Thats for the feedback. I will look at the links

gogh0
01-16-2012, 12:39 PM
This is an old thread, but just in case someone read this, Chris244 remark about using the proper DC to select the device on Window 7 seems to be broken only on Nvidia. With an ATI card it works as expected (at least on FirePro cards, not sure about Radeon), without using any specific OGL extension.