大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
本文将介绍一种不依赖任何第三方库,搭建自己Win32应用程序窗口的方法,程序总共长度为77行,源代码下载请看附件。如果不清楚怎么一步一步实现的,可以移步去看OpenGL入门级课程的视频教程。
成都创新互联自2013年起,先为日土等服务建站,日土等地企业,进行企业商务咨询服务。为日土企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。#include附件:http://down.51cto.com/data/2368079#include #include #pragma comment(lib,"opengl32.lib") LRESULT CALLBACK RenderWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_CLOSE: PostQuitMessage(0); break; } return DefWindowProc(hwnd, msg, wParam, lParam); } INT WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd) { WNDCLASSEX wndClass; wndClass.cbClsExtra = 0; wndClass.cbSize = sizeof(WNDCLASSEX); wndClass.cbWndExtra = 0; wndClass.hbrBackground = NULL; wndClass.hCursor = LoadCursor(NULL, IDC_ARROW); wndClass.hIcon = NULL; wndClass.hIconSm = NULL; wndClass.hInstance = hInstance; wndClass.lpfnWndProc = RenderWindowProc; wndClass.lpszClassName = L"OpenGLWindow"; wndClass.lpszMenuName = NULL; wndClass.style = CS_HREDRAW | CS_VREDRAW; ATOM atom = RegisterClassEx(&wndClass); HWND hwnd = CreateWindowEx(NULL,L"OpenGLWindow",L"OpenGL Render Window",WS_OVERLAPPEDWINDOW,100,100,800,600,NULL,NULL,hInstance,NULL); HDC dc = GetDC(hwnd); PIXELFORMATDESCRIPTOR pfd; memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)); pfd.nVersion = 1; pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_TYPE_RGBA; pfd.iLayerType = PFD_MAIN_PLANE; pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = 32; pfd.cDepthBits = 24; pfd.cStencilBits = 8; int pixelFormatID = ChoosePixelFormat(dc, &pfd); SetPixelFormat(dc, pixelFormatID, &pfd); HGLRC rc = wglCreateContext(dc); wglMakeCurrent(dc, rc); glClearColor(41.0 / 255.0f, 71.0f / 255.0f, 121.0f / 255.0f, 1.0f); ShowWindow(hwnd, SW_SHOW); UpdateWindow(hwnd); MSG msg; while (true) { if (PeekMessage(&msg,NULL,NULL,NULL,PM_REMOVE)) { if (msg.message==WM_QUIT) { break; } TranslateMessage(&msg); DispatchMessage(&msg); } glClear(GL_COLOR_BUFFER_BIT); SwapBuffers(dc); } return 0; }
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。