Open a window on a specific device (sli)

Hi

First post on these forums so hi everyone.

I have an SLI machine (2 GeForce 6600 GT cards).
I’m trying to open 2 openGL windows: 1 window on each of the cards.
I haven’t been able to find any win32 commands that enable me to open a window with an openGL rendering context for a specific device.

The normal process I use to open a window with an openGL rendering context:

// declare a window class
HWND hWnd = CreateWindow(…);
HDC hDC = GetDC(hWnd);
// choose pixel format code comes here
HGLRC hGLRC = wglCreateContext(hDC);
// …

According to MSDN if I want to open a DC for a specific device I have to do something like this:

// first get the device:
// can use EnumDisplayDevices to get and verify the device index.
int deviceIndex = 0 ;
DISPLAY_DEVICE displayDevice;
EnumDisplayDevices(NULL, deviceIndex, &displayDevice, 0);

// create a DC for the device
HDC hdc = CreateDC(deviceInfo->DeviceName, deviceInfo->DeviceName, 0, 0);

This is where I get stuck:
How do I create a window for the DC I just created for the device?
(Or how do I disconnect a window from its DC and connect it to another DC?)
The CreateWindow win32 function doesn’t get any parameter that allows me to
set the device that I want to use.

I need a code sample that shows how to create a window over a specifc device (or DC), or how to diconnect a window from its DC and connect it to another DC.

Thanks.

Each device control one of monitors. Try to open window on first monitor and then get it’s DC. Create another window on second monitor then get it’s DC.

DC’s should be different.

Using EnumMonitors API you can find positions of monitors. Use this values if you want to create fullscreen windows.

yooyo

Hi

Thanks.
But this doesn’t let me know which adpater I’m using to render the window.

I’ll get a different DC even when I open 2 windows on the same monitor.
The DC doesn’t change when I move the window between the 2 monitors.
When I open a window on a monitor I have no way of knowing (or deciding) what is the physical device I’m using to render the window.
I need a way to set the physical device the openGL render context will use.

Thanks.

Unfortunately this functionality (explicitly mapping a window to a specific GPU) is embedded into the WindowsAPI. There is no way to explicitly specify this. Windows automatically maps it to the appropriate GPU when you move it around.

If you want to explicitly map a window to a GPU use X11 in LINUX.

Thanks dimensionX
I was afraid of that we’re moving to linux anyway.

Hi guys,

Yes, this is a problematic area the way things are currently with windows and multiple GPUs. We’re investigating this at NVIDIA and hopefully we’ll have a solution sometime in the future.

Thanks,
Mark

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.