本文整理汇总了C++中GLWindow::OnRender方法的典型用法代码示例。如果您正苦于以下问题:C++ GLWindow::OnRender方法的具体用法?C++ GLWindow::OnRender怎么用?C++ GLWindow::OnRender使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLWindow
的用法示例。
在下文中一共展示了GLWindow::OnRender方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WindowProc
LRESULT CALLBACK GLWindow::WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
GLWindow* instance = (GLWindow*) GetWindowLongPtr(hwnd, GWL_USERDATA);
switch (msg)
{
case WM_CREATE:
{
CREATESTRUCT* create = (CREATESTRUCT*) lParam;
instance = (GLWindow*) create->lpCreateParams;
SetWindowLongPtr(hwnd, GWL_USERDATA, (LONG_PTR) instance);
return 0;
}
case WM_SIZE:
instance->OnResize(LOWORD(lParam), HIWORD(lParam));
return 0;
case WM_CLOSE:
DestroyWindow(hwnd);
case WM_DESTROY:
PostQuitMessage(0);
return 0;
case WM_KEYDOWN:
instance->OnKeyDown(wParam);
return 0;
case WM_RBUTTONDOWN:
case WM_LBUTTONDOWN:
SetCapture(hwnd);
instance->OnMouseDown(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
return 0;
case WM_RBUTTONUP:
case WM_LBUTTONUP:
ReleaseCapture();
instance->OnMouseUp(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
return 0;
case WM_MOUSEMOVE:
instance->OnMouseMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
return 0;
case WM_ERASEBKGND:
return 1;
case WM_PAINT:
if (GetUpdateRect(hwnd, NULL, FALSE))
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
instance->OnRender();
SwapBuffers(hdc);
EndPaint(hwnd, &ps);
}
return 0;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}