2

Hi!

Could someone anwser my question, please? My program has one thread for the window's message loop and another for D3D12 rendering. Everything is fine, but the question is what window proc. should do with WM_PAINT? Currently the app has such fragment of code:

case WM_PAINT:
    return 0;

Is there any better/more efficient way, or that is OK?

Acorn
  • 24,970
  • 5
  • 40
  • 69
  • 2
    That's typical for a 3D render loop. For more examples, see [this code](https://github.com/walbourn/directx-vs-templates/blob/master/d3d12game_win32/Main.cpp). – Chuck Walbourn Jan 28 '21 at 04:29
  • Dear Sir @chuck-walbourn, I highly appreciate the support. That code is interesting and I investigate it. The problem is, that my architecture has the additional thread for rendering and I do not know, what should I do with WM_PAINT message in such case (i do not want to use such feature). – Włodzimierz O. Kubera Jan 28 '21 at 16:50

1 Answers1

4

Typically a Win32 render loop will have a trivial paint for those cases where the rendering isn't started or is halted for some reason (so you at least can't see 'junk' behind your window).

    {
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            (void)BeginPaint(hWnd, &ps);
            EndPaint(hWnd, &ps);
        }
        break;

...
   }

    return DefWindowProc(hWnd, message, wParam, lParam);
Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81