# DBG call in openGL

**URL:** <https://forum.juce.com/t/dbg-call-in-opengl/54560>\
**Category:** General JUCE discussion\
**Created:** [January 16, 2023, 2:48pm UTC](https://forum.juce.com/t/dbg-call-in-opengl/54560 "2023-01-16T14:48:07Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mrugalla](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/mrugalla/32/13092_2.png) [@Mrugalla](https://forum.juce.com/u/Mrugalla)\
**Post date:** [January 16, 2023, 2:48pm UTC](https://forum.juce.com/t/dbg-call-in-opengl/54560/1 "2023-01-16T14:48:07Z")

</div>

in modules\juce\_opengl\opengl\juce\_OpenGLShaderProgram.cpp

in line 68 there’s this:  
GLuint shaderID = context.extensions.glCreateShader (type);

and it creates the following output into the console:  
OpenGL DBG message: Buffer detailed info: Buffer object 1 (bound to GL\_ARRAY\_BUFFER\_ARB, usage hint is GL\_STATIC\_DRAW) will use VIDEO memory as the source for buffer object operations.  
OpenGL DBG message: Buffer detailed info: Buffer object 2 (bound to GL\_ELEMENT\_ARRAY\_BUFFER\_ARB, usage hint is GL\_STATIC\_DRAW) will use VIDEO memory as the source for buffer object operations.

I’m still pretty new to openGL, but I’d appreciate it to not spam the console without giving a warning or error, since that is usually where I debug things. Can it be turned off? If no: Can you improve the code so that it doesn’t DBG into the console anymore?

---

<div class="post-metadata">

**Author:** ![Marcusonic](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@Marcusonic](https://forum.juce.com/u/Marcusonic)\
**Post date:** [January 16, 2023, 3:47pm UTC](https://forum.juce.com/t/dbg-call-in-opengl/54560/2 "2023-01-16T15:47:53Z")

</div>

the only way is in juce\_OpenGLContext.cpp initialiseOnThread() ignore that warning. I think that all notification type GL\_DEBUG\_SEVERITY\_NOTIFICATION could be ignored

> <https://github.com/juce-framework/JUCE/commit/ff1d5d6da44ccc6813da234ff2f303127b627b5c>

---

<div class="post-metadata">

**Author:** ![Marcusonic](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@Marcusonic](https://forum.juce.com/u/Marcusonic)\
**Post date:** [January 17, 2023, 6:32pm UTC](https://forum.juce.com/t/dbg-call-in-opengl/54560/3 "2023-01-17T18:32:36Z")

</div>

I finally found a solution that doesn’t need to modify that function or create a custom debug callback. It is possible to directly disable messages with OpenGL, in this case specifying the source, type and severity

> gl::glDebugMessageControl(gl::GL\_DEBUG\_SOURCE\_API, gl::GL\_DEBUG\_TYPE\_OTHER, gl::GL\_DEBUG\_SEVERITY\_NOTIFICATION, 0, 0, gl::GL\_FALSE );

It seems that it is possible to disable specific messages  
[https://registry.khronos.org/OpenGL-Refpages/gl4/html/glDebugMessageControl.xhtml](https://registry.khronos.org/OpenGL-Refpages/gl4/html/glDebugMessageControl.xhtml)

by the way, in the callback of Juce’s module it seems that there is an error, the first parameter is source, not type

---

<div class="post-metadata">

**Author:** ![aaronleese1](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aaronleese1/32/19725_2.png) [@aaronleese1](https://forum.juce.com/u/aaronleese1)\
**Post date:** [January 18, 2023, 3:53pm UTC](https://forum.juce.com/t/dbg-call-in-opengl/54560/4 "2023-01-18T15:53:50Z")

</div>

Updated to the latest JUCE and got this error this morning.

Would be happy to suppress and move on, except the UI is also now extremely slow.

Maybe something changed in the GL code that is causing problems on Windows?  
I tried breaking code execution to see if it’s stuck in a loop, but it’s not.  
Any interaction with the UI will happen (Eventually, as in 5 seconds late).

Setting all subcomponents invisible doesn’t help, so it’s not something that a particular element is doing, even an empty DocumentWindow still runs way too slowly.

No issues on mac, just windows.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [January 18, 2023, 3:55pm UTC](https://forum.juce.com/t/dbg-call-in-opengl/54560/5 "2023-01-18T15:55:49Z")

</div>

Is it slow in both debug and release mode?

---

<div class="post-metadata">

**Author:** ![aaronleese1](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aaronleese1/32/19725_2.png) [@aaronleese1](https://forum.juce.com/u/aaronleese1)\
**Post date:** [January 18, 2023, 3:56pm UTC](https://forum.juce.com/t/dbg-call-in-opengl/54560/6 "2023-01-18T15:56:15Z")

</div>

Yes, so it’s not just the error message printing.

Even with all components invisible, it is doing a bunch of UI/state refresh things … so it might still be related to something more specific. If I just use a generic test editor component I have laying around the issue gets much better.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [January 18, 2023, 3:58pm UTC](https://forum.juce.com/t/dbg-call-in-opengl/54560/7 "2023-01-18T15:58:14Z")

</div>

Are you able to bisect to find out which JUCE commit introduced the problem?

---

<div class="post-metadata">

**Author:** ![aaronleese1](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aaronleese1/32/19725_2.png) [@aaronleese1](https://forum.juce.com/u/aaronleese1)\
**Post date:** [January 18, 2023, 4:40pm UTC](https://forum.juce.com/t/dbg-call-in-opengl/54560/9 "2023-01-18T16:40:11Z")

</div>

On another note - how do I use the openGL command above (gl::glDebugMessageControl)?

If I paste that line just after my attachToComponent() line (or anywhere else I’ve tried) it crashes with access exception.

I would really like to disable this constant stream of debug outputs from GL.

---

<div class="post-metadata">

**Author:** ![aaronleese1](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aaronleese1/32/19725_2.png) [@aaronleese1](https://forum.juce.com/u/aaronleese1)\
**Post date:** [January 18, 2023, 4:51pm UTC](https://forum.juce.com/t/dbg-call-in-opengl/54560/10 "2023-01-18T16:51:37Z")

</div>

Yup, it was my issue.

---

<div class="post-metadata">

**Author:** ![Mrugalla](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/mrugalla/32/13092_2.png) [@Mrugalla](https://forum.juce.com/u/Mrugalla)\
**Post date:** [January 18, 2023, 5:31pm UTC](https://forum.juce.com/t/dbg-call-in-opengl/54560/11 "2023-01-18T17:31:05Z")

</div>

in my case the problem was solved by just putting this line at the beginning of newOpenGLContextCreated()

glDisable(GL\_DEBUG\_OUTPUT);

but disabling outputs manually like that seems like it could introduce other problems since debug messages are there for a reason i guess. i’m still an openGL noob though so idk

---

<div class="post-metadata">

**Author:** ![Marcusonic](https://avatars.discourse-cdn.com/v4/letter/m/f0a364/32.png) [@Marcusonic](https://forum.juce.com/u/Marcusonic)\
**Post date:** [January 21, 2023, 5:56am UTC](https://forum.juce.com/t/dbg-call-in-opengl/54560/12 "2023-01-21T05:56:05Z")

</div>

I changed to creating the component as OpenGLAppComponent, because I had problems and it works better for me. if you want you can test it very fast, just derive the component from that class and do the mandatory, which is override initialise(), shutdown() and render(), and in the destructor add shutdownOpenGL();

---

<div class="post-metadata">

**Author:** ![aaronleese1](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/aaronleese1/32/19725_2.png) [@aaronleese1](https://forum.juce.com/u/aaronleese1)\
**Post date:** [January 21, 2023, 2:54pm UTC](https://forum.juce.com/t/dbg-call-in-opengl/54560/13 "2023-01-21T14:54:40Z")

</div>

Ah, great to know.  
I’ll give that a look.
