From 7700efe1fcfb7956d129ccf3079b8a9d04bd89ac Mon Sep 17 00:00:00 2001 From: Brandon Wright Date: Fri, 2 Nov 2018 15:25:32 -0500 Subject: [PATCH] GTK+: Fix OpenGL without NPOT. --- gtk/src/gtk_display_driver_opengl.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/gtk/src/gtk_display_driver_opengl.cpp b/gtk/src/gtk_display_driver_opengl.cpp index 7c9c56b7..aeb68ebd 100644 --- a/gtk/src/gtk_display_driver_opengl.cpp +++ b/gtk/src/gtk_display_driver_opengl.cpp @@ -328,9 +328,25 @@ void S9xOpenGLDisplayDriver::update_texture_size (int width, int height) NULL); } - texture_width = width; - texture_height = height; + coords[9] = 1.0f; + coords[10] = 1.0f; + coords[11] = 1.0f; + coords[14] = 1.0f; } + else + { + coords[9] = height / 1024.0f; + coords[10] = width / 1024.0f; + coords[11] = height / 1024.0f; + coords[14] = width / 1024.0f; + } + + texture_width = width; + texture_height = height; + + glBindBuffer (GL_ARRAY_BUFFER, coord_buffer); + glBufferData (GL_ARRAY_BUFFER, sizeof (GLfloat) * 16, coords, GL_STATIC_DRAW); + glBindBuffer (GL_ARRAY_BUFFER, 0); } }