From 139e98ac3b060c6b0f13ea7587c1f1197486c656 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 6 Nov 2023 14:39:34 +1100 Subject: [PATCH] [client] OpenGL:fix RGB24 support for non 64-bit aligned pitches --- client/renderers/OpenGL/opengl.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/client/renderers/OpenGL/opengl.c b/client/renderers/OpenGL/opengl.c index a715c390..63deeb32 100644 --- a/client/renderers/OpenGL/opengl.c +++ b/client/renderers/OpenGL/opengl.c @@ -782,14 +782,12 @@ static enum ConfigStatus configure(struct Inst * this) this->vboFormat = GL_BGR; this->dataFormat = GL_UNSIGNED_BYTE; - /* The data that the host returns for 24-bit BGR is tightly packed into an - * array that the host GPU will support, we need to adjust the parameters - * here to the correct dimensions as OpenGL can use it directly + /* The data that the host returns is comes from a 32-bit RBGA texture, + * as OpenGL supports BGR directly we need to correct dimensions in order + * to make this happen. */ this->format.dataWidth = this->format.frameWidth; this->format.dataHeight = this->format.frameHeight; - this->format.stride = this->format.frameWidth; - this->format.pitch = this->format.frameWidth * 3; this->format.bpp = 24; break; @@ -1181,7 +1179,7 @@ static bool drawFrame(struct Inst * this) int bpp = this->format.bpp / 8; glPixelStorei(GL_UNPACK_ALIGNMENT , bpp < 4 ? 1 : 0); - glPixelStorei(GL_UNPACK_ROW_LENGTH, this->format.stride); + glPixelStorei(GL_UNPACK_ROW_LENGTH, this->format.frameWidth); this->texPos = 0; framebuffer_read_fn(