Hello Guest

GLUtil.getErrorString(errorCode)

  • 4 Replies
  • 4909 Views
GLUtil.getErrorString(errorCode)
« on: July 22, 2017, 17:09:39 »
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):
Code: [Select]
val errorCode = GL11.glGetError()
if (errorCode != GL11.GL_NO_ERROR) {
throw Exception("GL ERROR: " + GLUtil.getErrorString(errorCode) + " code: $errorCode")
}

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: GLUtil.getErrorString(errorCode)
« Reply #1 on: July 22, 2017, 19:23:15 »
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.

Re: GLUtil.getErrorString(errorCode)
« Reply #2 on: July 25, 2017, 17:23:31 »
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.
« Last Edit: July 25, 2017, 17:59:11 by nbilyk »

*

Offline spasi

  • *****
  • 2261
    • WebHotelier
Re: GLUtil.getErrorString(errorCode)
« Reply #3 on: July 25, 2017, 18:19:12 »
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.

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

I 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.

*

Offline CoDi

  • *
  • 49
Re: GLUtil.getErrorString(errorCode)
« Reply #4 on: July 26, 2017, 06:35:41 »
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:

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