any1 / wlvncc

A Wayland Native VNC Client
ISC License
94 stars 12 forks source link

disable linear filter when integer scaling #25

Open retrotails opened 1 year ago

retrotails commented 1 year ago

the following change uses nearest filtering if the window scale is an exact multiple, such as running a 1080p client full-screen on a 4k display.

diff --git a/src/renderer-egl.c b/src/renderer-egl.c
index 125bbb4..4d0acc8 100644
--- a/src/renderer-egl.c
+++ b/src/renderer-egl.c
@@ -527,6 +527,8 @@ void render_av_frames_egl(struct buffer* dst, struct vnc_av_frame** src,
        GLuint tex = texture_from_av_frame(frame->frame);
        glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex);

+       if (fmod(scale,1.0) == 0.0)
+           glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        gl_draw();

        glBindTexture(GL_TEXTURE_EXTERNAL_OES, 0);

I have only tested this with h264, it looks like it probably wouldn't work with the other modes and I don't know how to include it there.

any1 commented 1 year ago

Is this intended as an optimisation or to reduce blurriness?

retrotails commented 1 year ago

to reduce blur. sway and I think macOS and windows do the same for upscaled apps.