So I'm updating my project so that it uses the new LWJGL3 rather than 2.9.x.
I think I have most of the code that replaces "Display" set up right from following this http://www.lwjgl.org/guide and looking on the GLFW site, but when I try and run my code I get the following.
Exception in thread "Test" java.lang.UnsatisfiedLinkError: org.lwjgl.system.glfw.ErrorCallback$Util.setCallback(Ljava/lang/reflect/Method;)J
at org.lwjgl.system.glfw.ErrorCallback$Util.setCallback(Native Method)
at org.lwjgl.system.glfw.ErrorCallback$Util.<clinit>(ErrorCallback.java:61)
at GameEngine.Render.GameDisplay.createNewDisplay(GameDisplay.java:20)
at GameEngine.Render.Render.init(Render.java:56)
at GameEngine.Render.Render.<init>(Render.java:52)
at GameEngine.Render.DefaultRender.<init>(DefaultRender.java:26)
at GameEngine.GameEngine$Engine.initEngine(GameEngine.java:70)
at GameEngine.GameEngine$Engine.run(GameEngine.java:59)
at java.lang.Thread.run(Unknown Source)
The line that causes it is the following
GLFW.glfwSetErrorCallback(ErrorCallback.Util.getDefault());
Which is pretty much the first method called in the method, before that the only thing there is, is an initialized long variable, "window".
So what is the cause for the error?
Extra Info:
GameDisplay is a class containing static methods that are to do with window creation, atm there is a method "createNewDisplay" and "changeResolution".
Render is an abstract class that DefaultRender extends and then fully implements some of the methods.
Call Sys.touch(); before setting up the error callback. This is a temporary workaround and will be fixed soon, see this issue (https://github.com/LWJGL/lwjgl3/issues/17).
Ah, ok, thanks.
Also, what can I call instead of GLU.gluErrorString()?
Edit:
Had a quick look through the API, would Uitl.translateGLErrorString(int errorCode) do the trick?
You can use org.lwjgl.opengl.Util.translateGLErrorString(int errorCode)
Haha, you posted just before I finished editing my previous post.
And thanks.
The original issue has been resolved (https://github.com/LWJGL/lwjgl3/commit/e9e3b483268540af6d2bcc14dfeb2d0fc362d3f1), there is no need anymore to call Sys.touch() explicitly.
quick report: got the same error (unsatisfied link error when calling glfwSetErrorCallback). Using Sys.touch fixed it. Using the stable release from the download page.
Have you tried with the latest nightly?
just tried with the latest nightly (red, bleeding edge link!) and worked without the Sys.touch.
I could even register my own callback (scala):
glfwSetErrorCallback(new ErrorCallback.StrAdapter() {
override def invoke(e: Int, d: String) = { quit(new RuntimeException(s"$e: $d")) }})