From e33bd9c8f96394a89cd82c24c1db8b87009d324f Mon Sep 17 00:00:00 2001 From: Clownacy Date: Sat, 25 Jan 2020 14:26:15 +0000 Subject: [PATCH] Fix visual artefacting on the Pi I'm not sure why there was linear filtering when I was rendering at 1:1 pixel ratio, but it did happen. This fixes it by forcing nearest-neighbour. The artefacting was caused by the linear filtering blending with pixels outside the specified texture coordinates, creating lines around everything. Fun fact: the framebuffer technique CSE2 uses is demanding on the Pi (1278x720 runs at 60 FPS when the framebuffer is forced to 852x480, even though all the internal rendering is still 1278x720). I guess rendering those extra 920160 pixels really takes its toll. --- src/Backends/Rendering/OpenGL3.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Backends/Rendering/OpenGL3.cpp b/src/Backends/Rendering/OpenGL3.cpp index 295497f2..68ed547d 100644 --- a/src/Backends/Rendering/OpenGL3.cpp +++ b/src/Backends/Rendering/OpenGL3.cpp @@ -664,8 +664,8 @@ Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height) #else glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); #endif - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); #ifndef USE_OPENGLES2 @@ -924,8 +924,8 @@ Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width free(buffer); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); #ifndef USE_OPENGLES2