diff --git a/gl.c b/gl.c index 3e25b8e5fd..b81666a955 100644 --- a/gl.c +++ b/gl.c @@ -31,6 +31,8 @@ static GLuint tex_filter; typedef struct gl { bool vsync; + unsigned real_x; + unsigned real_y; } gl_t; @@ -152,7 +154,7 @@ static float tv_to_fps(const struct timeval *tv, const struct timeval *new_tv, i static bool gl_frame(void *data, const uint16_t* frame, int width, int height) { - (void)data; + gl_t *gl = data; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -175,10 +177,10 @@ static bool gl_frame(void *data, const uint16_t* frame, int width, int height) float h = 224.0/256.0; - glTexCoord2f(0, h); glVertex3i(0, 0, 0); + glTexCoord2f(0, h*height/gl->real_y); glVertex3i(0, 0, 0); glTexCoord2f(0, 0); glVertex3i(0, 1, 0); - glTexCoord2f(1, 0); glVertex3i(1, 1, 0); - glTexCoord2f(1, h); glVertex3i(1, 0, 0); + glTexCoord2f((float)width/gl->real_x, 0); glVertex3i(1, 1, 0); + glTexCoord2f((float)width/gl->real_x, h*height/gl->real_y); glVertex3i(1, 0, 0); glEnd(); @@ -268,6 +270,9 @@ static void* gl_init(video_info_t *video, const input_driver_t **input) exit(1); } + gl->real_x = video->input_scale * 256; + gl->real_y = video->input_scale * 224; + glEnable(GL_TEXTURE_2D); glEnable(GL_DITHER); glEnable(GL_DEPTH_TEST); diff --git a/ssnes.c b/ssnes.c index ee55373044..a7d02ca3fa 100644 --- a/ssnes.c +++ b/ssnes.c @@ -151,18 +151,20 @@ static void uninit_audio(void) static void init_video_input(void) { int scale; + + // We multiply scales with 2 to allow for hi-res games. #if VIDEO_FILTER == FILTER_NONE - scale = 1; -#elif VIDEO_FILTER == FILTER_HQ2X scale = 2; -#elif VIDEO_FILTER == FILTER_HQ4X +#elif VIDEO_FILTER == FILTER_HQ2X scale = 4; +#elif VIDEO_FILTER == FILTER_HQ4X + scale = 8; #elif VIDEO_FILTER == FILTER_GRAYSCALE - scale = 1; + scale = 2; #elif VIDEO_FILTER == FILTER_BLEED - scale = 1; + scale = 2; #else - scale = 1; + scale = 2; #endif video_info_t video = {