From: bones_was_here Date: Thu, 5 Sep 2024 18:47:46 +0000 (+1000) Subject: GL: Use the render path switch properly in GL_ReadPixelsBGRA() X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f94c856fa7e0baeadd8c21e16ac4643c4e4f7639;p=xonotic%2Fdarkplaces.git GL: Use the render path switch properly in GL_ReadPixelsBGRA() This will be needed for screenshots to work with GLES when standard builds support both GLES and GL. Signed-off-by: bones_was_here --- diff --git a/gl_backend.c b/gl_backend.c index ba2adf73..02f7bc29 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -1522,9 +1522,11 @@ void GL_ReadPixelsBGRA(int x, int y, int width, int height, unsigned char *outpi switch(vid.renderpath) { case RENDERPATH_GL32: - case RENDERPATH_GLES2: CHECKGLERROR -#ifndef GL_BGRA + qglReadPixels(x, y, width, height, GL_BGRA, GL_UNSIGNED_BYTE, outpixels);CHECKGLERROR + break; + case RENDERPATH_GLES2: // glReadPixels() lacks GL_BGRA support (even in ES 3.2) + CHECKGLERROR { int i; int r; @@ -1544,10 +1546,7 @@ void GL_ReadPixelsBGRA(int x, int y, int width, int height, unsigned char *outpi // outpixels[i+3] = a; } } -#else - qglReadPixels(x, y, width, height, GL_BGRA, GL_UNSIGNED_BYTE, outpixels);CHECKGLERROR -#endif - break; + break; } }