@@ -146,24 +146,26 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs,
146146 std::pair<int , int > gl_versions[] = {{4 , 4 }, {4 , 3 }, {4 , 2 }};
147147 for (size_t i = 0 ; i < _countof (gl_versions) && m_Context == NULL ; ++i)
148148 {
149+ // Setup attributes for a new OpenGL rendering context
149150 const auto & version = gl_versions[i];
150151 MajorVersion = version.first ;
151152 MinorVersion = version.second ;
152- // Setup attributes for a new OpenGL rendering context
153+
154+ int ContextFlags = WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
155+ if (InitAttribs.EnableValidation )
156+ {
157+ ContextFlags |= WGL_CONTEXT_DEBUG_BIT_ARB;
158+ }
159+
153160 int attribs[] =
154161 {
155162 WGL_CONTEXT_MAJOR_VERSION_ARB, MajorVersion,
156163 WGL_CONTEXT_MINOR_VERSION_ARB, MinorVersion,
157- WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB ,
164+ WGL_CONTEXT_FLAGS_ARB, ContextFlags ,
158165 GL_CONTEXT_PROFILE_MASK, GL_CONTEXT_CORE_PROFILE_BIT,
159166 0 , 0 //
160167 };
161168
162- if (InitAttribs.EnableValidation )
163- {
164- attribs[5 ] |= WGL_CONTEXT_DEBUG_BIT_ARB;
165- }
166-
167169 // Create new rendering context
168170 // In order to create new OpenGL rendering context we have to call function wglCreateContextAttribsARB(),
169171 // which is an OpenGL function and requires OpenGL to be active when it is called.
0 commit comments