GL Debug Output: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
'''Debug Output''' is an OpenGL feature that makes [https://www.opengl.org/wiki/Error_Checking Error Checking] from functions easier. | '''Debug Output''' is an OpenGL feature that makes [https://www.opengl.org/wiki/Error_Checking Error Checking] from functions easier. | ||
In order to get more information about Debug Output, you can read the main opengl [https://www.opengl.org/wiki/Debug_Output wiki page] | In order to get more information about Debug Output, you can read the main opengl [https://www.opengl.org/wiki/Debug_Output 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. | 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. | ||
Line 8: | Line 8: | ||
* [https://github.com/sgothel/jogl/blob/b3ecc88efca2a2f969e1e5a375086148821ee3c5/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java#L103 TestGLDebug00NEWT] | * [https://github.com/sgothel/jogl/blob/b3ecc88efca2a2f969e1e5a375086148821ee3c5/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java#L103 TestGLDebug00NEWT] | ||
* [https://github.com/sgothel/jogl/blob/b3ecc88efca2a2f969e1e5a375086148821ee3c5/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java#L71 TestGLDebug01NEWT] | * [https://github.com/sgothel/jogl/blob/b3ecc88efca2a2f969e1e5a375086148821ee3c5/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java#L71 TestGLDebug01NEWT] | ||
There is also a sample, [https://github.com/elect86/jogl-samples/blob/master/jogl-samples/src/tests/gl_420/Gl_420_debug_output.java 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: | |||
glWindow.getContext().enableGLDebugMessage(true/false); | |||
gl4.glEnable/Disable(GL_DEBUG_OUTPUT); | |||
Same for setting the synchronous option: | |||
glWindow.getContext().setGLDebugSynchronous(true/false); | |||
gl4.glEnable/Disable(GL_DEBUG_OUTPUT_SYNCHRONOUS); | |||
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: | |||
glWindow.getContext().glDebugMessageInsert( | |||
GL_DEBUG_SOURCE_APPLICATION, | |||
GL_DEBUG_TYPE_OTHER, 1, | |||
GL_DEBUG_SEVERITY_MEDIUM, | |||
"Message"); | |||
gl4.glDebugMessageInsert( | |||
GL_DEBUG_SOURCE_APPLICATION, | |||
GL_DEBUG_TYPE_OTHER, 1, | |||
GL_DEBUG_SEVERITY_MEDIUM, | |||
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. |
Latest revision as of 13:55, 28 January 2016
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:
glWindow.getContext().enableGLDebugMessage(true/false);
gl4.glEnable/Disable(GL_DEBUG_OUTPUT);
Same for setting the synchronous option:
glWindow.getContext().setGLDebugSynchronous(true/false);
gl4.glEnable/Disable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
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:
glWindow.getContext().glDebugMessageInsert( GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 1, GL_DEBUG_SEVERITY_MEDIUM, "Message");
gl4.glDebugMessageInsert( GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 1, GL_DEBUG_SEVERITY_MEDIUM, 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.