From 7f1e979aadb3a464f8040bbeff7c0ae8fb720c5e Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 1 May 2023 14:52:55 +0200 Subject: [PATCH] Gui: add comment about troubleshooting OpenGL --- src/Gui/View3DInventorViewer.cpp | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 695b546cd0..64d1f442bc 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -287,6 +287,42 @@ public: * * \section overview Overview * \todo Overview and complements for the 3D Viewer + * + * \section trouble Troubleshooting + * When it's needed to capture OpenGL function calls then the utility apitrace + * can be very useful: https://github.com/apitrace/apitrace/blob/master/docs/USAGE.markdown + * + * To better locate the problematic code it's possible to add custom log messages. + * For the prerequisites check: + * https://github.com/apitrace/apitrace/blob/master/docs/USAGE.markdown# + * emitting-annotations-to-the-trace + * \code + * #include + * #include + * + * void GLRender(SoGLRenderAction* glra) + * { + * int context = glra->getCacheContext(); + * const cc_glglue * glue = cc_glglue_instance(context); + * + * PFNGLPUSHDEBUGGROUPPROC glPushDebugGroup = (PFNGLPUSHDEBUGGROUPPROC) + * cc_glglue_getprocaddress(glue, "glPushDebugGroup"); + * PFNGLDEBUGMESSAGEINSERTARBPROC glDebugMessageInsert = (PFNGLDEBUGMESSAGEINSERTARBPROC) + * cc_glglue_getprocaddress(glue, "glDebugMessageInsert"); + * PFNGLPOPDEBUGGROUPPROC glPopDebugGroup = (PFNGLPOPDEBUGGROUPPROC) + * cc_glglue_getprocaddress(glue, "glPopDebugGroup"); + * + * glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, __FUNCTION__); + * ... + * glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, + * 0, GL_DEBUG_SEVERITY_MEDIUM, -1, "begin_blabla"); + * ... + * glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, + * 0, GL_DEBUG_SEVERITY_MEDIUM, -1, "end_blabla"); + * ... + * glPopDebugGroup(); + * } + * \endcode */