GLUtil.getErrorString(errorCode)

Started by nbilyk, July 22, 2017, 17:09:39

Previous topic - Next topic

nbilyk

I just updated to LWJGL 3.1.2 and GLUtil.getErrorString(errorCode) doesn't seem to exist anymore. What's the new way to do this?

Previous code (Kotlin):
val errorCode = GL11.glGetError()
if (errorCode != GL11.GL_NO_ERROR) {
	throw Exception("GL ERROR: " + GLUtil.getErrorString(errorCode) + " code: $errorCode")
}

spasi

A much better alternative is to use a debug context and GLUtil.setupDebugMessageCallback().

If you still need GLUtil.getErrorString, you can copy/paste the code from here.

nbilyk

Thanks for the quick response.

I actually do use setupDebugMessageCallback (GLUtil.setupDebugMessageCallback(System.out)), but I see no message after my problem. GL11.glGetError() is giving me a 1282 code when I try to call glUseProgram (the shader compiles, just doesn't bind), but the message callback is never hit.

The problem is happening on a linux laptop from 2005, so I don't know how much I care about fixing the actual problem, but I would like it if I at least got a better message for what's going on. It seems to be working fine windows desktop.

spasi

Quote from: nbilyk on July 25, 2017, 17:23:31GL11.glGetError() is giving me a 1282 code when I try to call glUseProgram (the shader compiles, just doesn't bind), but the message callback is never hit.

Have you checked both the shader compilation and program linking information logs?

Quote from: nbilyk on July 25, 2017, 17:23:31I actually do use setupDebugMessageCallback (GLUtil.setupDebugMessageCallback(System.out))
...
The problem is happening on a linux laptop from 2005

It's likely that the driver does not support debug output. setupDebugMessageCallback returns null in this case. The choice is also printed on stderr if you run your program with -Dorg.lwjgl.util.Debug=true.

CoDi

Quote from: nbilyk on July 25, 2017, 17:23:31
I actually do use setupDebugMessageCallback (GLUtil.setupDebugMessageCallback(System.out)), but I see no message after my problem.

I just want to mention, because I forgot to do that myself more than once ;D - you also need to activate the debug context:

glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);


The debug output is probably very spammy by default, so you may want to disable the NOTIFICATION level.