Hello Guest

LWJGL3 4.3 debugging. How do I get the message?

  • 5 Replies
  • 8834 Views
*

Offline asyx

  • *
  • 23
LWJGL3 4.3 debugging. How do I get the message?
« 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

Code: [Select]
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?

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: LWJGL3 4.3 debugging. How do I get the message?
« Reply #1 on: March 11, 2015, 17:11:17 »
Hey asyx,

You can get a Java String like this:

Code: [Select]
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.:

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

*

Offline asyx

  • *
  • 23
Re: LWJGL3 4.3 debugging. How do I get the message?
« Reply #2 on: March 11, 2015, 23:11:14 »
That's easier than I expected. Thanks.

*

Offline doev

  • *
  • 22
Re: LWJGL3 4.3 debugging. How do I get the message?
« Reply #3 on: October 12, 2015, 11:57:04 »
If you would simply like to print the error message, see the setupDebugMessageCallback method on GLContext, e.g.:

Code: [Select]
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?

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: LWJGL3 4.3 debugging. How do I get the message?
« Reply #4 on: October 12, 2015, 12:15:52 »
The setupDebugMessageCallback methods have moved to the GLUtil class:

Code: [Select]
GL.createCapabilities();
debugProc = GLUtil.setupDebugMessageCallback();

Re: LWJGL3 4.3 debugging. How do I get the message?
« Reply #5 on: October 12, 2015, 15:58:34 »
With the latest nightly builds you can also use the getMessage utility method inside GLDebugMessageCallback.

Code: [Select]
String msg = getMessage(length, message);