Drawing a quad with a texture mapped to it with the fixed OpenGL pipeline is one of the easiest things to do in OpenGL.
And for some madmaking, mysterious, dumb reason I can't get it to work.
I loaded a texture through Slick:
texture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("resources/textures/texture.png"), false);
I setup my 2D projection:
glDisable(GL_DEPTH_TEST); glDisable(GL_TEXTURE_2D); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 1, -1); glMatrixMode(GL_MODELVIEW); glLoadIdentity();
Then in my game loop I call:
texture.bind(); glEnable(GL_TEXTURE_2D); glBegin(GL_QUADS); glTexCoord2f(0.0f, 1.0f); glVertex2f(0, 0); glTexCoord2f(1.0f, 1.0f); glVertex2f(300, 0); glTexCoord2f(1, 0); glVertex2f(300, 90); glTexCoord2f(0.0f, 0.0f); glVertex2f(0, 90); glEnd();
This is my texture:
And this is what I get:
It's smaller, and as you can see it's all wrong. It's kind of embarrassing that I have to ask this question, but it has keeping me busy for a few hours now.