Re: [osg-users] Creating an OpenGL debug context

2021-03-25 Thread Voerman, L.
Not exactly what you're asking for, but this is extracted from my code:
Laurens.

#ifdef OPENGL_DEBUG
void APIENTRY DebugCallback(GLenum source, GLenum type, GLuint id, GLenum
severity, GLsizei length, const GLchar * message, const void* userParam) {
printf("0x % X: %s\n", id, message);
}
#endif


class EnableGLDebugCallback : public osg::GraphicsOperation
{
public:
EnableGLDebugCallback() :
GraphicsOperation("EnableGLDebug", true),
_dirty(true) { }
virtual void operator () (osg::GraphicsContext* context) {
if (_dirty) {
#ifdef OPENGL_DEBUG
if (osg::isGLExtensionSupported(contextID, "GL_KHR_debug")) {
//PFNGLDEBUGMESSAGECALLBACKPROC
PFNGLDEBUGMESSAGECALLBACKPROC glDebugMessageCallback =
(PFNGLDEBUGMESSAGECALLBACKPROC)wglGetProcAddress("glDebugMessageCallback");
PFNGLDEBUGMESSAGECONTROLPROC glDebugMessageControl =
(PFNGLDEBUGMESSAGECONTROLPROC)wglGetProcAddress("glDebugMessageControl");
glDebugMessageCallback(DebugCallback, NULL);
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0,
GL_TRUE);
glEnable(GL_DEBUG_OUTPUT);
//glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
}
#endif
_dirty = false;
}
}
protected:
bool_dirty;
};
};

in main thread:
osg::GraphicsContext *gc =
_viewer->getCamera()->getGraphicsContext();
if (gc) {
gc->add(new EnableGLDebugCallback());
OSGRC_DEBUG("EnableGLDebugCallback installed" << std::endl);
}

On Thu, Mar 25, 2021 at 11:41 AM Werner Modenbach <
werner.modenb...@modenbach-ac.de> wrote:

> Hi all,
>
> does anybody know how to create an opengl debug context via flags in the
> traits?
>
> Thanks
>
> - Werner -
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Creating an OpenGL debug context

2021-03-25 Thread Werner Modenbach
Hi all,

does anybody know how to create an opengl debug context via flags in the traits?

Thanks

- Werner -
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org