Move Windows WGL context attributes to renderer gl
This commit is contained in:
27
src/main.cpp
27
src/main.cpp
@@ -974,28 +974,7 @@ int main(int argc, char** argv)
|
||||
// If supported create a 3.3 context
|
||||
if (GLAD_WGL_ARB_create_context)
|
||||
{
|
||||
int contex_attribs[] =
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 3,
|
||||
WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,
|
||||
WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||
0
|
||||
};
|
||||
int pixel_attribs[] =
|
||||
{
|
||||
WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
|
||||
WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
|
||||
WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
|
||||
WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB,
|
||||
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
|
||||
WGL_COLOR_BITS_ARB, 24,
|
||||
WGL_DEPTH_BITS_ARB, 16,
|
||||
//WGL_STENCIL_BITS_ARB, 8,
|
||||
//WGL_SAMPLE_BUFFERS_ARB, 1, // Number of buffers (must be 1 at time of writing)
|
||||
//WGL_SAMPLES_ARB, 4, // Number of samples
|
||||
0
|
||||
};
|
||||
const auto wgl_config = pp::renderer::gl::windows_wgl_core_context_3_3_config();
|
||||
UINT numFormat;
|
||||
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
@@ -1007,9 +986,9 @@ int main(int argc, char** argv)
|
||||
(float)(clientRect.bottom - clientRect.top), 0, 0, hInst, 0);
|
||||
|
||||
hDC = GetDC(hWnd);
|
||||
wglChoosePixelFormatARB(hDC, pixel_attribs, nullptr, 1, &pxfmt, &numFormat);
|
||||
wglChoosePixelFormatARB(hDC, wgl_config.pixel_format_attributes.data(), nullptr, 1, &pxfmt, &numFormat);
|
||||
SetPixelFormat(hDC, pxfmt, &pfd);
|
||||
hRC = wglCreateContextAttribsARB(hDC, NULL, contex_attribs);
|
||||
hRC = wglCreateContextAttribsARB(hDC, NULL, wgl_config.context_attributes.data());
|
||||
wglMakeCurrent(hDC, hRC);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user