Reputation: 37
So I've recently started making a simple 2-D java game using jlwgl and slick-util. I ran into a problem when trying to load in textures to place on my tiles. I am using slick util to try and load textures in. This is the method I am using to do so.
public static Texture loadTex(String path, String fileType) {
Texture tex = null;
InputStream in = ResourceLoader.getResourceAsStream(path);
try {
tex = TextureLoader.getTexture(fileType, in);
} catch (IOException e) {
e.printStackTrace();
}
return tex;
}
I then set a variable "t" to store a variable to check if the texture loading works.
Texture t = loadTex("res/grass64.png","PNG");
I use a glQUADS method to draw a textured square.
public static void drawQuadTex(Texture tex, float x, float y, float width,
float height) {
tex.bind();
glTranslatef(x, y, 0);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2f(0, 0);
glTexCoord2f(1, 0);
glVertex2f(width, 0);
glTexCoord2f(1, 1);
glVertex2f(width, height);
glTexCoord2f(0, 1);
glVertex2f(0, height);
glLoadIdentity();
glEnd();
}
Calling drawQuadTex...
drawQuadTex(t,0,0,64,64);
I encountered an error:
"Exception in thread "main" java.lang.NoSuchMethodError: org.lwjgl.opengl.GL11.glGetInteger(ILjava/nio/IntBuffer;)V "
I'm not sure what quite is going on. Any assistance would be appreciated as this is my first attempt at any java that's not a simple school assignment. If I need to post anything else, please let me know.
Upvotes: 3
Views: 702
Reputation: 1714
The slick-util library is part of slick2d, which is now deprecated and no longer compatible with recent LWJGL versions such as the one which you appear to be using. This is why you are getting this error.
Upvotes: 1