5#include <alicorn/platform/winapi-check.hpp>
8#pragma comment(lib, "opengl32.lib")
53static PIXELFORMATDESCRIPTOR PixelFormatDescriptor = { 0 };
55OpenGL::OpenGL(
const Data_t & _Data) :
57 m_hWnd(::covellite::any_cast<HWND>(_Data.Handle)),
58 m_hDeviceContex(USING_MOCK ::GetDC(m_hWnd))
60 WINAPI_CHECK (m_hDeviceContex != NULL);
62 PixelFormatDescriptor.nSize =
sizeof(PIXELFORMATDESCRIPTOR);
63 PixelFormatDescriptor.nVersion = 1;
64 PixelFormatDescriptor.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
65 PixelFormatDescriptor.iPixelType = PFD_TYPE_RGBA;
66 PixelFormatDescriptor.cColorBits = 32;
67 PixelFormatDescriptor.cAlphaBits = 8;
68 PixelFormatDescriptor.cDepthBits = 32;
69 PixelFormatDescriptor.iLayerType = PFD_MAIN_PLANE;
75# pragma warning(disable: 6387)
77 const auto PixelFormat = USING_MOCK ::ChoosePixelFormat(m_hDeviceContex,
78 &PixelFormatDescriptor);
79 WINAPI_CHECK (PixelFormat != 0);
81 WINAPI_CHECK USING_MOCK ::SetPixelFormat(m_hDeviceContex, PixelFormat,
82 &PixelFormatDescriptor);
86 m_hRenderContex = USING_MOCK ::wglCreateContext(m_hDeviceContex);
87 WINAPI_CHECK (m_hRenderContex != NULL);
89 WINAPI_CHECK USING_MOCK ::wglMakeCurrent(m_hDeviceContex, m_hRenderContex);
96OpenGL::~OpenGL(
void)
noexcept
98 USING_MOCK ::wglMakeCurrent(NULL, NULL);
99 USING_MOCK ::wglDeleteContext(m_hRenderContex);
101 USING_MOCK ::ReleaseDC(m_hWnd, m_hDeviceContex);
104void OpenGL::PresentFrame(
void)
106 WINAPI_CHECK USING_MOCK ::SwapBuffers(m_hDeviceContex);
108 OpenGLCommonShader::PresentFrame();
Класс входит в проект Covellite.Api Вспомогательный класс, содержащий общий для Windows и Android к...
Определения OpenGLCommonShader.hpp:32