How to disable mipmaps in OpenGL

I am making a 2D sprite engine in OpenGL and I want to disable mipmaps because 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 have a white rectangle, 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 a correctly textured rectangle

I realized that this may be due to activated mipmaps, but, unfortunately, I can not find information on how I can disable them.

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

+6
source share
1 answer
 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 

This should be the default value. Make sure you do not change it to MIPMAP somewhere.

+15
source

Source: https://habr.com/ru/post/901106/


All Articles