GL Debug Output

From JogampWiki
Revision as of 14:55, 28 January 2016 by Gbarbieri (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Debug Output is an OpenGL feature that makes Error Checking from functions easier.

In order to get more information about Debug Output, you can read the main opengl wiki page. You should read that first before continuing.

The difference with plain OpenGL is that in Jogl, if you want to enable Debug Output, you have to do it at the begin, before the context gets created.

There are two tests in jogl-demos, that show how you can achieve this:

There is also a sample, gl-420-debug-output from the jogl-samples that it is interesting to take a look at. Indeed, once enabled from the startup, there are different way you can turn it on/off. First of all, you should be aware that there are now two ways of affecting the debut, one is acting directly on jogl, the other is setting directly OpenGL through opengl calls. You can now enable/disable Debug Output using either:


Same for setting the synchronous option:


Control the messages:

glWindow.getContext().glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, null, 0, true);
gl4.glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, null, 0, true);

Or insert them:

                   GL_DEBUG_TYPE_OTHER, 1,
                   GL_DEBUG_TYPE_OTHER, 1,
                   message1.length(), message1);

Anyway it is also important to mention that, of course, OpenGL settings have the priority over the Jogl's one. You should always be coherent with the way you took.