An image of a minecraft grass block in gimp:

enter image description here

Loading from a texture atlas in OpenGL, gives a much blurrier image:

enter image description here

I know that the actual image in my glfw window is larger than it is in gimp. (640x640 window, 64x64 image in gimp) Is it possible that OpenGL is seeing this increase in size, and automatically interpolating the image, not keeping the sharpness between "pixels" on the block?

I am a beginner with OpenGL, so any suggestion on how to fix this would be appreciated.

  • 1
    \$\begingroup\$ That blur is caused by bilinear filtering. Many graphics APIs enable bilinear filtering by default, because usually we don't want textures to look pixelated. I don't work with OpenGL directly, so I can't answer your question. However, if you do a web search for 'opengl disable bilinear', you'll get plenty of results (though it looks like most of them are more than 10 years old). \$\endgroup\$
    – Kevin
    Commented Mar 20 at 1:24
  • 3
    \$\begingroup\$ I'm a beginner with OpenGL myself, but you're probably setting the texture using GL_LINEAR instead of GL_NEAREST, which asks for interpolated instead of pixelated scaling. You can read this wiki page for details. \$\endgroup\$
    – Holo
    Commented Mar 20 at 3:33

1 Answer 1


Texture filters

When creating a texture buffer you can set the pixel lookup method via the glTexParameteri call. See link for full details.

Example creates texture handle and set the pixel lookup filter used when reading pixels from the texture.

GLint lookup = GL_NEAREST; // gives pixelated render Does not interpolate
                           // or GL_LINEAR for smooth, the default setting
GLuint hdl;
glGenTextures(1, &hdl);
glBindTexture(GL_TEXTURE_2D, hdl);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, lookup);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, lookup);

You must log in to answer this question.

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