Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
469 views
in Technique[技术] by (71.8m points)

windows - WM_PAINT and DX12

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?

question from:https://stackoverflow.com/questions/65929978/wm-paint-and-dx12

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...