Hi.
On a machine with two display outputs, I am trying to create a window that appears on the second
display and render some OpenGL texture on the window.
For the purpose of explaining my problem, I created the window such that left half of the window
appeared on the first display and the right half appeared on the second display with this code :
// Note : this CreateWindowEX is taken from NeHe tutorial 1
hwnd=CreateWindowEx( dwExStyle, // Extended Style For The Window
“OpenGL”, // Class Name
title, // Window Title
dwStyle | // Defined Window Style
WS_CLIPSIBLINGS | // Required Window Style
WS_CLIPCHILDREN, // Required Window Style
WindowRect.right / 2, 0, // Window Position
WindowRect.right-WindowRect.left, // Calculate Window Width
WindowRect.bottom-WindowRect.top, // Calculate Window Height
NULL, // No Parent Window
NULL, // No Menu
hInstance, // Instance
NULL))) // Dont Pass Anything To WM_CREATE
HDC hdc = GetDC(hwnd);
PIXELFORMATDESCRIPTOR pfd;
GLuint PixelFormat = ChoosePixelFormat(hdc,&pfd);
SetPixelFormat(hdc,PixelFormat,pfd);
HGLRC hrc = wglCreateContext(hdc);
wglMakeCurrent(hdc,hrc);
for(;; )
{
Render();
SwapBuffers(hdc);
}
When I used only 1 graphics card with 2 display outputs, I could see the left half of the rendered texture on the first display
and the other half on the second display. In this case, it worked fine.
However, when I used 2 graphics card (1 output from 1 card), I could see the left half of the rendered texture on the first display,
but nothing other than the window borders on the second display.
Seeing the window borders on the second display, I am pretty convinced that the HDC spans across the 2 displays.
The problem is most likely the OpenGL rendering context, HGLRC.
I am beginning to think that when I did all the OpenGL rendering, the rendered texture data went only to the first graphics card
and not the second card, which explained this behavior.
Please correct me if you think I am wrong.
Ultimately I want to create the window and render only on the second display.
When I tried to create window only on the second display and do all the GetDC stuff,
I could see only window borders on the second display.
Can anybody please tell me how you would solve this problem ?
I have tried CreateDC with \.\DISPLAY2 as device name.
Successfully created HDC and HGLRC but wglMakeCurrent(hDC,hRC) returned error.
Thank you,
Celios