Search code examples
javaopengltextureslwjgl

LWJGL/OpenGL Disable Smoothing Textures When "Zoomed In"


I have a 16*16 texture, and when i draw it to the screen, It seems to be zooming in (I think its called MipMapping) , but "smoothing out" the texture, whereas I just want the pixels to increase in size.

It's kind of hard to explain, so I put up a picture that you can see:

img http://photoupload.org/images/94135450192227784004.png

As you can see, its trying to smooth it out, where i just want a bigger picture, looking something like this:

img2 http://photoupload.org/images/95943288748957761603.png

How do i fix this? Does it have something to do with me using Slick Util?


Solution

  • The "zooming in" you are seeing is called magnification. To fix it, you need to set the MAG filter to GL_NEAREST, which does the effect you want:

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);