LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: asyx on March 11, 2015, 15:36:19

Title: LWJGL3 4.3 debugging. How do I get the message?
Post by: asyx on March 11, 2015, 15:36:19
Hello!

With LWJGL 2.x, you'd get a string as a parameter in the invoke method. But now, the invoke method looks like this

public void invoke(int source, int type, int id, int severity, int length, long message, long userParam)

So, how do I get the message, as a string, from the pointer I've got here?
Title: Re: LWJGL3 4.3 debugging. How do I get the message?
Post by: spasi on March 11, 2015, 17:11:17
Hey asyx,

You can get a Java String like this:

import static org.lwjgl.system.MemoryUtil.*;
// ...
String msg = memDecodeUTF8(memByteBuffer(message, length));


If you would simply like to print the error message, see the setupDebugMessageCallback method on GLContext, e.g.:

debugProc = GLContext.createFromCurrent().setupDebugMessageCallback();
It will also choose the best debug output implementation available (from GL43, KHR_debug, ARB_debug_output, AMD_debug_output).
Title: Re: LWJGL3 4.3 debugging. How do I get the message?
Post by: asyx on March 11, 2015, 23:11:14
That's easier than I expected. Thanks.
Title: Re: LWJGL3 4.3 debugging. How do I get the message?
Post by: doev on October 12, 2015, 11:57:04
Quote from: spasi on March 11, 2015, 17:11:17
If you would simply like to print the error message, see the setupDebugMessageCallback method on GLContext, e.g.:

debugProc = GLContext.createFromCurrent().setupDebugMessageCallback();
It will also choose the best debug output implementation available (from GL43, KHR_debug, ARB_debug_output, AMD_debug_output).

This is not working anymore (3.0.0b_build35), cause "GLContext" is not available. What is the recommend way to switch on opengl error/debug messages?
Title: Re: LWJGL3 4.3 debugging. How do I get the message?
Post by: spasi on October 12, 2015, 12:15:52
The setupDebugMessageCallback methods have moved to the GLUtil class:

GL.createCapabilities();
debugProc = GLUtil.setupDebugMessageCallback();
Title: Re: LWJGL3 4.3 debugging. How do I get the message?
Post by: FortressBuilder on October 12, 2015, 15:58:34
With the latest nightly builds you can also use the getMessage utility method inside GLDebugMessageCallback.


String msg = getMessage(length, message);