Hello Guest

Can't load png file with slick-util: java.lang.NoSuchMethodError

  • 3 Replies
  • 8095 Views
Hi, I got lwjgl working on my computer and I am trying to load a png with slick util. Lwjgl alone is working just fine, but when I added slick-util to my project, it crashes when I try to load an image(see code below).

Code: [Select]
Texture tex;
try {
tex = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("rsrc/tux.png")); // <==== Crash Line
} catch (IOException e) {
e.printStackTrace();
}

I added the jar file for slick util in eclipse. I didn't add any natives for slick, I searched and it seems like I just have to add the jar file(am I right here?). The error code is this one:

Code: [Select]
Exception in thread "main" java.lang.NoSuchMethodError: org.lwjgl.opengl.GL11.glGetInteger(ILjava/nio/IntBuffer;)V
at org.newdawn.slick.opengl.renderer.ImmediateModeOGLRenderer.glGetInteger(ImmediateModeOGLRenderer.java:194)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:317)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:254)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:200)
at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:64)
at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:24)
at HelloWorld.loop(HelloWorld.java:106)
at HelloWorld.run(HelloWorld.java:32)
at HelloWorld.main(HelloWorld.java:152)

I think that it may have to do with the project's setup. But the lwjgl natives are there. Maybe it's just that slick works with lwjgl2?
Anyway, I can't get it to work, Any Ideas?
« Last Edit: April 17, 2015, 15:03:13 by ochi12 »

*

Offline abcdef

  • ****
  • 335
Re: Can't load png file with slick-util: java.lang.NoSuchMethodError
« Reply #1 on: April 17, 2015, 15:38:39 »
Quote
Maybe it's just that slick works with lwjgl2?

Slick hasn't been update for a long time, if there are any method changes in LWJGL3 (which there are) that effect slick then it won't work.

*

Offline kappa

  • *****
  • 1316
Re: Can't load png file with slick-util: java.lang.NoSuchMethodError
« Reply #2 on: April 17, 2015, 19:52:27 »
The main Slick-Util download is for LWJGL2, you can grab a LWJGL3 compatible version of Slick-Util from here.

Re: Can't load png file with slick-util: java.lang.NoSuchMethodError
« Reply #3 on: April 17, 2015, 22:10:38 »
The main Slick-Util download is for LWJGL2, you can grab a LWJGL3 compatible version of Slick-Util from here.
I see, thanks, hope they maintain this version of slick-util. Also, where can I find the doc for this library? I didn't even find the download on my own
« Last Edit: April 17, 2015, 22:19:03 by ochi12 »