aboutsummaryrefslogtreecommitdiff
path: root/src/frontend
diff options
context:
space:
mode:
authorRSDuck <rsduck@users.noreply.github.com>2021-01-02 08:55:48 +0100
committerRSDuck <rsduck@users.noreply.github.com>2021-01-02 08:55:48 +0100
commit18fe5c67592b560236b7f0ed9663826293648626 (patch)
tree44fefe21551f903c2d7e5918c47642f4f3085535 /src/frontend
parentfa4363ede69bcef919310863ba262c9691c179e6 (diff)
prevent bleeding in screen texture
fixes #920
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/qt_sdl/main.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/frontend/qt_sdl/main.cpp b/src/frontend/qt_sdl/main.cpp
index 8e44bf0..d7821fa 100644
--- a/src/frontend/qt_sdl/main.cpp
+++ b/src/frontend/qt_sdl/main.cpp
@@ -867,22 +867,26 @@ void ScreenPanelGL::initializeGL()
screenShader->setUniformValue("ScreenTex", (GLint)0);
screenShader->release();
+ // to prevent bleeding between both parts of the screen
+ // with bilinear filtering enabled
+ const int paddedHeight = 192*2+2;
+ const float padPixels = 1.f / paddedHeight;
- float vertices[] =
+ const float vertices[] =
{
0, 0, 0, 0,
- 0, 192, 0, 0.5,
- 256, 192, 1, 0.5,
+ 0, 192, 0, 0.5 - padPixels,
+ 256, 192, 1, 0.5 - padPixels,
0, 0, 0, 0,
- 256, 192, 1, 0.5,
+ 256, 192, 1, 0.5 - padPixels,
256, 0, 1, 0,
- 0, 0, 0, 0.5,
+ 0, 0, 0, 0.5 + padPixels,
0, 192, 0, 1,
256, 192, 1, 1,
- 0, 0, 0, 0.5,
+ 0, 0, 0, 0.5 + padPixels,
256, 192, 1, 1,
- 256, 0, 1, 0.5
+ 256, 0, 1, 0.5 + padPixels
};
glGenBuffers(1, &screenVertexBuffer);
@@ -903,7 +907,10 @@ void ScreenPanelGL::initializeGL()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 192*2, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, paddedHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ // fill the padding
+ u8 zeroData[256*4*4] = {0};
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 192, 256, 2, GL_RGBA, GL_UNSIGNED_BYTE, zeroData);
OSD::Init(this);
}
@@ -941,7 +948,7 @@ void ScreenPanelGL::paintGL()
{
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 256, 192, GL_RGBA,
GL_UNSIGNED_BYTE, GPU::Framebuffer[frontbuf][0]);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 192, 256, 192, GL_RGBA,
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 192+2, 256, 192, GL_RGBA,
GL_UNSIGNED_BYTE, GPU::Framebuffer[frontbuf][1]);
}
}