Normal texture drawn aufully - SLICK_UTIL + LWJGL

I just loaded a texture binded it and then drawn a cube with the texture. Here is the code:
t = texture
x,y = coordinates

	t.bind();
		glBegin(GL_QUADS);
			glTexCoord2f(0,0);
			glVertex2f(x,y);
			glTexCoord2f(1,0);
			glVertex2f(x + t.getImageWidth() ,y);
			glTexCoord2f(1,1);
			glVertex2f(x + t.getImageWidth() ,y + t.getImageHeight());
			glTexCoord2f(0,1);
			glVertex2f(x,y + t.getImageHeight());
		glEnd();

SO , take a look at the normal image:

And when drawing the image (modelview matrix )
there are some weird lines and resizing

Ideas?

I am guessing your texture size is not a power of two.

Slick util automatically converts non-power-of-two images into power-of-two images, filling the rest of the image black (at least it’s supposed to, but doesn’t do that apparently :wink: ). Therefore you would draw too much if you’d use the texture coords [icode](0, 0)[/icode] and [icode](1, 1)[/icode].

The texture coords you actually need are [icode](0, 0)[/icode] and [icode](t.getWidth(), t.getHeight())[/icode]. Your code should therefore look like this:


   t.bind();
   glBegin(GL_QUADS);
      glTexCoord2f(0,0);
      glVertex2f(x,y);
      glTexCoord2f(t.getWidth(),0);
      glVertex2f(x + t.getImageWidth() ,y);
      glTexCoord2f(t.getWidth(),t.getHeight());
      glVertex2f(x + t.getImageWidth() ,y + t.getImageHeight());
      glTexCoord2f(0,t.getHeight());
      glVertex2f(x,y + t.getImageHeight());
   glEnd();

Yeap , solved it! Thanks!!!