I can't render my scene under a child window which is in my main window. I got two Registered windows:
mainwindow = CreateWindow(bgwinNAME,
TEXT("Benchmark"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(mhwnd, SW_MAXIMIZE);
UpdateWindow(mainwindow);
childwindow = CreateWindow(benchwinNAME,
NULL,
WS_CHILD,
(GetSystemMetrics(SM_CXSCREEN)-width)/2,
(GetSystemMetrics(SM_CYSCREEN)-hight)/2,
width,
hight,
mainwindow,
NULL,
hInstance,
NULL);
UpdateWindow(childwindow);
(the childwindow is later shown)
My loop looks like:
while(TRUE)
{
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
if(msg.message == WM_QUIT)
break;
StartOpenGL(childwindow, &hdc, &hrc );
// .... my GL functions
SwapBuffers(hdc);
}
StopOpenGL(childwindow, hdc, hrc );
return msg.wParam;
}
When childwindow is set as a hwnd in StartOpenGL(); there is no reaction I can only see a window with a white bg defined in window class (hbrBackground). When hwnd is set to mainwindow scene renders in it at range of SW_MAXIMIZE.
My StartOpenGL & StopOpenGL functions are from: Link