LWJGL Forum

Programming => OpenGL => Topic started by: Godfjott on May 14, 2015, 23:59:38

Title: lwjgl 3 and debug output
Post by: Godfjott on May 14, 2015, 23:59:38
I'm struggling a bit with glDebugMessageCallback in lwjgl v.3.0.0a. Most examples use ARBDebugOutputCallback and ARBDebugOutputCallback.Handler, but they don't seem to be a part of the library anymore. The message argument is passed as a long (pointer), how do I get the string representation of the message?
Title: Re: lwjgl 3 and debug output
Post by: spasi on May 15, 2015, 08:17:05
You have to use org.lwjgl.system.MemoryUtil (https://github.com/LWJGL/lwjgl3/blob/master/modules/core/src/main/java/org/lwjgl/system/MemoryUtil.java) methods (or roll your own):

// creates a ByteBuffer starting at the 'message' pointer, with capacity equal to 'length', then decodes it as a UTF8 string
String msg = memDecodeUTF8(memByteBuffer(message, length));

See this (https://github.com/LWJGL/lwjgl3/blob/master/modules/core/src/main/java/org/lwjgl/opengl/GLContext.java#L155) and the code that follows for examples.
Title: Re: lwjgl 3 and debug output
Post by: Godfjott on May 15, 2015, 08:58:41
Thanks