From: kub Date: Tue, 20 May 2025 19:47:34 +0000 (+0200) Subject: gl: add texture filter selection X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5411ac21e460a08bf0c510b479ba23ab23b3ed43;p=libpicofe.git gl: add texture filter selection --- diff --git a/gl.c b/gl.c index 975520e..9c1fbfc 100644 --- a/gl.c +++ b/gl.c @@ -144,8 +144,9 @@ int gl_init(void *display, void *window, int *quirks, int w, int h) goto out; // no mipmaps - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + ret = *quirks & GL_QUIRK_SCALING_NEAREST ? GL_NEAREST : GL_LINEAR; + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ret); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ret); //glViewport(0, 0, 512, 512); glLoadIdentity(); diff --git a/gl.h b/gl.h index 760960d..86475e2 100644 --- a/gl.h +++ b/gl.h @@ -40,5 +40,6 @@ static __inline void gl_finish(void) {} #endif #define GL_QUIRK_ACTIVATE_RECREATE 1 +#define GL_QUIRK_SCALING_NEAREST 2 #endif // LIBPICOFE_GL_H diff --git a/plat_sdl.c b/plat_sdl.c index 2dd5368..c4f8fa9 100644 --- a/plat_sdl.c +++ b/plat_sdl.c @@ -395,4 +395,11 @@ int plat_sdl_is_fullscreen(void) // consider window title bar and screen menu here return window_w >= fs_w && window_h >= fs_h - 2*window_b; } + +void plat_sdl_gl_scaling(int type) +{ + gl_quirks &= ~GL_QUIRK_SCALING_NEAREST; + if (type == 0) + gl_quirks |= GL_QUIRK_SCALING_NEAREST; +} // vim:shiftwidth=2:expandtab diff --git a/plat_sdl.h b/plat_sdl.h index e0513e3..c23cd66 100644 --- a/plat_sdl.h +++ b/plat_sdl.h @@ -13,4 +13,5 @@ int plat_sdl_is_fullscreen(void); int plat_sdl_change_video_mode(int w, int h, int force); void plat_sdl_overlay_clear(void); void plat_sdl_event_handler(void *event_); +void plat_sdl_gl_scaling(int type); void plat_sdl_finish(void);