OpenGL 4.6 feature: GL_CONTEXT_FLAG_NO_ERROR_BIT not working

I’ve been trying to create an opengl context using the GL_CONTEXT_FLAG_NO_ERROR_BIT as WGL_CONTEXT_FLAGS_ARB.

The context is created without error, however when I check at runtime when the context is active, gl says that this flag is not enabled.

Here are a few code snippets:

int iContextAttribs[11];
iContextAttribs[0] = WGL_CONTEXT_MAJOR_VERSION_ARB;
iContextAttribs[1] = 4;
iContextAttribs[2] = WGL_CONTEXT_MINOR_VERSION_ARB;
iContextAttribs[3] = 6;
iContextAttribs[4] = WGL_CONTEXT_PROFILE_MASK_ARB;
iContextAttribs[5] = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
iContextAttribs[6] = 0x2097; //WGL_CONTEXT_RELEASE_BEHAVIOR_ARB; //https://www.opengl.org/registry/specs/KHR/context_flush_control.txt
iContextAttribs[7] = 0x0000; //WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB;//speed up MakeCurrent calls by disabling implicit glFlush
iContextAttribs[8] = WGL_CONTEXT_FLAGS_ARB;
iContextAttribs[9] = theApp.m_glLoggingEnabled ? 0 : GL_CONTEXT_FLAG_NO_ERROR_BIT;
iContextAttribs[10] = 0;

and when the context is created, I check:

const char *version = (char*)glGetString( GL_VERSION );
GLint flags;
glGetIntegerv(GL_CONTEXT_FLAGS, &flags);

if(flags & GL_CONTEXT_FLAG_NO_ERROR_BIT)
{
bool hit = true;
}

version returns 4.6 however flags is always just 0.

Am I doing something wrong? GPU is a GTX2080Ti and driver version is: 417.35

It’s not a context flag in the context creation API. It’s an attribute called WGL/GLX_CONTEXT_OPENGL_NO_ERROR_ARB, which takes GL_TRUE/GL_FALSE as a value:

iContextAttribs[8] = WGL_CONTEXT_OPENGL_NO_ERROR_ARB;
iContextAttribs[9] = theApp.m_glLoggingEnabled ? GL_FALSE : GL_TRUE;

One clue to mistakes like these is that pretty much every enumerator given to WGL/GLX functions ought to have an extension suffix on it. Also, they’re always prefixed by WGL/GLX :wink:

Thank you very much Alfonse!

Working like a charm now :smile:

And thank you for the tip, makes sense regarding the enums.