ref: e33bd9c8f96394a89cd82c24c1db8b87009d324f
parent: 99a8b2bd188aa14ab817dbe59546ce8c5cdcef03
author: Clownacy <[email protected]>
date: Sat Jan 25 09:26:15 EST 2020
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.
--- a/src/Backends/Rendering/OpenGL3.cpp
+++ b/src/Backends/Rendering/OpenGL3.cpp
@@ -664,8 +664,8 @@
#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 @@
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