About example SampleClient3D

NatNet, VRPN, TrackD, and Plugins
Post Reply
weifeng0715
Posts: 10
Joined: Tue May 07, 2013 8:00 am

About example SampleClient3D

Post by weifeng0715 »

In the WinMain function:

while(TRUE)
{
if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
//Dispatches incoming sent messages, checks the thread message queue for a posted message, and retrieves the message (if any exist).
{
if(!GetMessage(&msg, NULL, 0, 0))
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
if(render)
{
HDC hDC = GetDC(msg.hwnd);
if(hDC)
{
wglMakeCurrent(hDC, g_hRenderContext);
Render();
SwapBuffers(hDC);
wglMakeCurrent(0, 0);
}
ReleaseDC(msg.hwnd, hDC);
}
}
}

Why not like this? or what is the function of this piece of code?

while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
HDC hDC = GetDC(msg.hwnd);
if(hDC)
{
wglMakeCurrent(hDC, g_hRenderContext);
Render();
SwapBuffers(hDC);
wglMakeCurrent(0, 0);
}
ReleaseDC(msg.hwnd, hDC);
}
Post Reply