From 01e408e4c8f5816d969a1af1c38bb264678417fa Mon Sep 17 00:00:00 2001 From: BearOso Date: Sun, 8 Oct 2023 11:03:27 -0500 Subject: [PATCH] (Qt,Gtk)/OpenGL: Specify unpack alignment. --- gtk/src/gtk_display_driver_opengl.cpp | 1 + qt/src/EmuCanvasOpenGL.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/gtk/src/gtk_display_driver_opengl.cpp b/gtk/src/gtk_display_driver_opengl.cpp index b085a0b1..039bf38b 100644 --- a/gtk/src/gtk_display_driver_opengl.cpp +++ b/gtk/src/gtk_display_driver_opengl.cpp @@ -125,6 +125,7 @@ void S9xOpenGLDisplayDriver::update(uint16_t *buffer, int width, int height, int update_texture_size(width, height); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_UNPACK_ROW_LENGTH, stride_in_pixels); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, buffer); diff --git a/qt/src/EmuCanvasOpenGL.cpp b/qt/src/EmuCanvasOpenGL.cpp index a075826c..4a3a0668 100644 --- a/qt/src/EmuCanvasOpenGL.cpp +++ b/qt/src/EmuCanvasOpenGL.cpp @@ -245,6 +245,7 @@ void EmuCanvasOpenGL::uploadTexture() glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glPixelStorei(GL_UNPACK_ROW_LENGTH, output_data.bytes_per_line / 2); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB565, output_data.width, output_data.height, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, output_data.buffer); }