Hey Guys,
Hoping there are some Win32 guys out there since I have a bit of an issue. So I'm rendering to a child window of my Win32 application with D3D11. For the most part, everything is well, and good. However when I go to actually render some geometry to the screen my backbuffer flashes. At first I thought it was Z-Fighting, however having ruled that out, it almost looks as if there are two presents going on.
The one that I know about, the call to the swapChains method to present the backbuffer, and another one buried in Win32 callback code somewhere. I'm wondering if there is a simple fix for this. I don't need the application to run at anything more than 20fps to be completely honest. So throw some suggestions at me, if ya got them.
The child window I render to:
hPanel = CreateWindowEx(NULL, L"RR", L"None", WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, 40, 20, 500, 500, hWnd, nullptr, nullptr, nullptr);
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_BUTTON1:
//If Button pressed, retrieve text from textArea, and locate it in wide string
text.resize(GetWindowTextLength(hEdit)+1);
GetWindowText(hEdit, &text[0], text.size());
SetWindowText(hEdit, L"");
break;
}
break;
case WM_PAINT:
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
I'm a bit of a Win32 noob. One common suggestion I see is to throw the D3D rendering code into WM_PAINT case, but I was wondering if there are other ways.
Thanks,
Marcus