Problem with textures slick.util and lwjgl

So, I recently started building a simple 2D java game using jlwgl and slick-util. I ran into a problem when trying to load textures to place on my tiles. I am using slick util to upload and download textures. This is the method I am using for this.

 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;
}

      

Then I set the "t" variable to hold the variable to check if the texture loading is working.

     Texture t = loadTex("res/grass64.png","PNG");

      

I am using 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 ran into the error:

"Exception in stream" main "java.lang.NoSuchMethodError: org.lwjgl.opengl.GL11.glGetInteger (ILjava / nio / IntBuffer;) V"

I'm not sure what's going on. Any help would be appreciated as this is my first try in any java that is not a simple school assignment. If I need to post anything else, please let me know.

+3


source to share


1 answer


The slick-util library is part of slick2d which is now deprecated and no longer compatible with the latest LWJGL versions like the one you are using. This is why you are getting this error.



+1


source







All Articles