lwjgl 3 and debug output

Started by Godfjott, May 14, 2015, 23:59:38

Previous topic - Next topic

Godfjott

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?

spasi

You have to use org.lwjgl.system.MemoryUtil 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 and the code that follows for examples.