How to disable mipmaps in OpenGL

PiotrK picture PiotrK · Nov 9, 2011 · Viewed 11.6k times · Source

I am making 2D sprite engine in OpenGL and I want to disable mipmaps, as I do not need them.

When I call:

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, internal->internal_w, internal->internal_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, internal->data);
RenderWithThisTexture();

I got white rect, but when I call:

gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, internal->internal_w, internal->internal_h, GL_RGBA, GL_UNSIGNED_BYTE, internal->data);
RenderWithThisTexture();

I got the properly textured rect

I figured out that this may be because of enabled mipmaps, but sadly I can't find any info how I can disable them.

I want to stick with OpenGL 1.1 (not OGL 2.0 or above code)

Answer

Piotr Praszmo picture Piotr Praszmo · Nov 9, 2011
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

This should be the default. Make sure you are not changing it to MIPMAP somewhere.