I am developing a game in Java using LWJGL2 and Slick, and I am encountering an issue when rendering a graphic. Instead of filling the quad with the texture, it appears to be partly repeating it. The image is simply a white box, but this is how it is appearing when the program is run: I am loading the image using Slick:
this.texture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("Res\\image.png"));
and I am using this code to render it:
texture.bind(); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0,0); GL11.glVertex2f(position.x,position.y); GL11.glTexCoord2f(1,0); GL11.glVertex2f(position.x + size.x,position.y); GL11.glTexCoord2f(1,1); GL11.glVertex2f(position.x + size.x,position.y + size.y); GL11.glTexCoord2f(0,1); GL11.glVertex2f(position.x,position.y + size.y); GL11.glEnd();
If I remove all the code for textures and just render a coloured quad, it displays as expected. Could you please point me in the right direction as to where I am going wrong?