From a2cb611b6c94fd32cd1e7fa49b12c2c33b6b2d3b Mon Sep 17 00:00:00 2001 From: bjorn Date: Thu, 14 Apr 2022 16:16:22 -0700 Subject: [PATCH] Fix mipmaps with nearest filtering; --- src/modules/graphics/opengl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modules/graphics/opengl.c b/src/modules/graphics/opengl.c index 52ca60ce..bd726a68 100644 --- a/src/modules/graphics/opengl.c +++ b/src/modules/graphics/opengl.c @@ -1932,8 +1932,13 @@ void lovrTextureSetFilter(Texture* texture, TextureFilter filter) { switch (filter.mode) { case FILTER_NEAREST: - glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(texture->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + if (texture->mipmaps) { + glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST); + glTexParameteri(texture->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } else { + glTexParameteri(texture->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(texture->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } break; case FILTER_BILINEAR: