Browse Source

创建800*600的画布

master
blobt 4 years ago
parent
commit
89a7ed4e33
  1. BIN
      .vs/shader2/v14/.suo
  2. 14
      main.cpp

BIN
.vs/shader2/v14/.suo

14
main.cpp

@ -55,15 +55,17 @@ INT WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
int windowWidth = 800; int windowWidth = 800;
int windowHeight = 600; 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); 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);//获取设备上下文 HDC dc = GetDC(hwnd);//获取设备上下文
PIXELFORMATDESCRIPTOR pfd; PIXELFORMATDESCRIPTOR pfd;

Loading…
Cancel
Save