|
|
@ -55,15 +55,17 @@ INT WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine |
|
|
|
int windowWidth = 800; |
|
|
|
int windowHeight = 600; |
|
|
|
|
|
|
|
RECT rect; |
|
|
|
rect.left = 0; |
|
|
|
rect.right = windowWidth; |
|
|
|
rect.bottom = windowHeight; |
|
|
|
rect.top = 0; |
|
|
|
|
|
|
|
AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, false); |
|
|
|
|
|
|
|
//窗口名称一定要和刚才注册窗口的保持一致
|
|
|
|
HWND hwnd = CreateWindowEx(NULL, L"GLWindow", L"OpenGL Window", WS_OVERLAPPEDWINDOW, 100, 100, windowWidth, windowHeight, NULL, NULL, hinstance, NULL); |
|
|
|
|
|
|
|
//获取实际窗口大小
|
|
|
|
RECT rect; |
|
|
|
GetClientRect(hwnd, &rect); |
|
|
|
windowWidth = rect.right - rect.left; |
|
|
|
windowHeight = rect.bottom - rect.top; |
|
|
|
|
|
|
|
//设置渲染环境
|
|
|
|
HDC dc = GetDC(hwnd);//获取设备上下文
|
|
|
|
PIXELFORMATDESCRIPTOR pfd; |
|
|
|