0
votes

I am mapping a very large background texture to a quad for a sidescroller. The texture's graphics do not have any aliasing, and therein lies the problem.

The texture ends up very blurry. The image size is 800 x 600. Do the dimensions have to be a power of 2? If so, Am I stuck making a larger image at 1024 x 1024 and leaving the excess offscreen?

I am doing everything in orthographic mode. Here is the application of the texture to quad.

glEnable(GL_COLOR_MATERIAL);
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, *texture); 

    glBegin(GL_QUADS);
        glNormal3f(0.0f, 0.0f, 1.0f);
        glTexCoord2f(0.0f, 1.0f); glVertex3f(pos_x, pos_y, depth);
        glTexCoord2f(1.0f, 1.0f); glVertex3f(pos_x + size_x, pos_y, depth);
        glTexCoord2f(1.0f, 0.0f); glVertex3f(pos_x + size_x, pos_y + size_y, depth);
        glTexCoord2f(0.0f, 0.0f); glVertex3f(pos_x, pos_y + size_y, depth);
    glEnd();

    glDisable(GL_TEXTURE_2D);
    glDisable(GL_COLOR_MATERIAL);
1
Please show us how you output your texture to screen. What perspective do you use, how do you map the texture to polygons? Maybe some relevant code quotes - Kromster

1 Answers

4
votes

Maybe you need to disable mipmap filtering when creating your texture:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);