My image is 1280x800, and my screen size is 1280x800. It should draw perfectly. I'm creating a quad the size of the screen, and setting the texture to fit the quad. But right now it draws a square texture on my upper left corner of my screen that's out of scale and not large enough.

I don't know why it doesn't work, I've tried writing the size of the texture larger when drawing and it seems to work sort-of, but I don't know why it didn't work when drawing on a 1280x800 quad.

How do I create a fullscreen quad?

Here's how I'm currently doing it:

This is my OPENGL and display setup code:

    DisplayMode displayMode = null;
    DisplayMode[] modes = Display.getAvailableDisplayModes();

    for (int i = 0; i < modes.length; i++) {
        if (modes[i].getWidth() == World.SCREEN_WIDTH && modes[i].getHeight() == World.SCREEN_HEIGHT && modes[i].isFullscreenCapable()) {
            displayMode = modes[i];


    glOrtho(0, World.SCREEN_WIDTH, World.SCREEN_HEIGHT, 0, 1, -1);

This is my code for drawing the textured quad:

    background = TextureLoader.getTexture("PNG", new FileInputStream(new File("res/menu/background.png")));

    glBindTexture(GL_TEXTURE_2D, background.getTextureID());
    glTexCoord2f(0, 0);
    glVertex2f(0, 0); // Upper left

    glTexCoord2f(1, 0);
    glVertex2f(World.SCREEN_WIDTH, 0); // Upper right

    glTexCoord2f(1, 1);
    glVertex2f(World.SCREEN_WIDTH, World.SCREEN_HEIGHT); // Lower right

    glTexCoord2f(0, 1);
    glVertex2f(0, World.SCREEN_HEIGHT); // Lower left
  • \$\begingroup\$ Sounds like Slick2D creates a texture that is power-of-two size. See slick.ninjacave.com/forum/viewtopic.php?p=26076 \$\endgroup\$
    – msell
    Commented Aug 21, 2013 at 11:42
  • \$\begingroup\$ @msell Then how to I cover my 1280x800 screen? \$\endgroup\$
    – Louis Hong
    Commented Aug 21, 2013 at 11:45
  • 2
    \$\begingroup\$ While this might be true problem to you, this seems to be more like "debug my code" type of question, that does not fit to stack exchange Q/A style. \$\endgroup\$
    – Katu
    Commented Aug 21, 2013 at 13:43
  • \$\begingroup\$ Actually it's not, this is a true LWJGL problem. I've got the answer to the question. But I dislike how people with high rank goes around giving down votes with out really looking at the content @Katu \$\endgroup\$
    – Louis Hong
    Commented Aug 21, 2013 at 14:41
  • 1
    \$\begingroup\$ Power-of-two sizing shouldn't matter as the texcoords used will either stretch or squeeze the texture to fill the screen. More probable is that the modelview matrix is not identity - see my answer below. \$\endgroup\$ Commented Aug 21, 2013 at 16:15

1 Answer 1


A probable cause is that you may not have identity in your modelview matrix when you come to draw the fullscreen quad. This could happen if you're drawing anything else before the quad.

I note from your setup code that you correctly switch the matrix mode to GL_MODELVIEW, but then you don't make a glLoadIdentity call after doing so (this is OK as it should be initially identity, but it's a good habit to get into).

When drawing your quad, you have it surrounded by a glPushMatrix/glPopMatrix call. This on it's own isn't sufficient to make a matrix identity; from the specification:

glPushMatrix pushes the current matrix stack down by one, duplicating the current matrix. That is, after a glPushMatrix call, the matrix on top of the stack is identical to the one below it.

(My emphasis.)

In other words, if your previous modelview matrix was not identity, then following the glPushMatrix call the new modelview matrix will also not be identity.

The simplest fix is to add a glLoadIdentity after your glPushMatrix call.

  • \$\begingroup\$ Wow, this is very complicated. How do matrixes work? \$\endgroup\$
    – Louis Hong
    Commented Aug 21, 2013 at 16:14
  • 1
    \$\begingroup\$ You should look for some tutorial material for that - it's very off-topic for this site. \$\endgroup\$ Commented Aug 21, 2013 at 16:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .