Click to See Complete Forum and Search --> : Open a window on a specific device (sli)


FuzzCube
August 8th, 2005, 09:02 AM
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.