<div dir="ltr">Not exactly what you're asking for, but this is extracted from my code:<div>Laurens.</div><div><br></div><div>#ifdef OPENGL_DEBUG<br>void APIENTRY DebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * message, const void* userParam) {<br> printf("0x % X: %s\n", id, message);<br>}<br>#endif<br><br><br> class EnableGLDebugCallback : public osg::GraphicsOperation<br> {<br> public:<br> EnableGLDebugCallback() :<br> GraphicsOperation("EnableGLDebug", true),<br> _dirty(true) { }<br> virtual void operator () (osg::GraphicsContext* context) {<br> if (_dirty) {<br>#ifdef OPENGL_DEBUG<br> if (osg::isGLExtensionSupported(contextID, "GL_KHR_debug")) {<br> //PFNGLDEBUGMESSAGECALLBACKPROC<br> PFNGLDEBUGMESSAGECALLBACKPROC glDebugMessageCallback = (PFNGLDEBUGMESSAGECALLBACKPROC)wglGetProcAddress("glDebugMessageCallback");<br> PFNGLDEBUGMESSAGECONTROLPROC glDebugMessageControl = (PFNGLDEBUGMESSAGECONTROLPROC)wglGetProcAddress("glDebugMessageControl");<br> glDebugMessageCallback(DebugCallback, NULL);<br> glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0, GL_TRUE);<br> glEnable(GL_DEBUG_OUTPUT);<br> //glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);<br> }<br>#endif<br> _dirty = false;<br> }<br> }<br> protected:<br> bool _dirty;<br> };<br>};<br><br>in main thread:<br> osg::GraphicsContext *gc = _viewer->getCamera()->getGraphicsContext();<br> if (gc) {<br> gc->add(new EnableGLDebugCallback());<br> OSGRC_DEBUG("EnableGLDebugCallback installed" << std::endl);<br> }<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 25, 2021 at 11:41 AM Werner Modenbach <<a href="mailto:Werner.Modenbach@modenbach-ac.de">Werner.Modenbach@modenbach-ac.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all,<br>
<br>
does anybody know how to create an opengl debug context via flags in the traits?<br>
<br>
Thanks<br>
<br>
- Werner -<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org" target="_blank">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div>