LWJGL Slick-Util Strange problems with drawing a texture several times

Hello everyone!

I discovered a strange bug and I can’t find an explanation for that. Most times (about 80% of the cases but not everytime) when I draw a model with the same texture as the model before the texture is not painted. I unbind all textures everytime before I bind a new one and I can’t find the reason for this bug.

Here’s my texture binding part:

public void render(float x, float y, float z, float rY, float scale, Texture t)
	{
		glEnable(GL_TEXTURE_2D);
		glBindTexture(GL_TEXTURE_2D, 0);
		
		if(t != null)
			t.bind();

Any ideas?

Your unbinding is the problem. Look up the bind() implementation in the source: it stores the last bound texture in a static variable and does skip binding, if the texture is the same to optimize performance (texture binds are expensive). You can call TextureImpl.unbind() to clear that static variable.

Thank you!