I recently started using LWJGL in my java programs for the graphics. I'm currently working on a simple game, which I make, to get better at this kind of programming. I ran into some trouble when adding textures to my 2D game.
To show my problem, I have made a simple program which shows one quad with a texture. This is how the texture looks:
However my program shows it like this:
You see the right and the bottom have some strange line hanging there. the shown picture is 100x100 from the top left to the little pixel right down.
The code used for drawing this is:
texture1.bind(); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0f,0f); GL11.glVertex2f(100, 200); GL11.glTexCoord2f(1f,0f); GL11.glVertex2f(200, 200); GL11.glTexCoord2f(1f,1f); GL11.glVertex2f(200, 100); GL11.glTexCoord2f(0f,1f); GL11.glVertex2f(100, 100); GL11.glEnd();
This code is called before drawing:
GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glOrtho(0, width, 0, height, -1, 1);
When I use
so 0.9f instead of 1.0f the weird lines don't appear. But that's no real solution because I want to use the whole texture not 90% of it.
I hope I did not ask something which has been asked before, I really couldn't find I using google, it is however quite hard to think of the right search words.