]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
GL: Use the render path switch properly in GL_ReadPixelsBGRA()
authorbones_was_here <bones_was_here@xonotic.au>
Thu, 5 Sep 2024 18:47:46 +0000 (04:47 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 12 Sep 2024 13:53:35 +0000 (23:53 +1000)
This will be needed for screenshots to work with GLES when standard
builds support both GLES and GL.

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
gl_backend.c

index ba2adf73c994bc4b4f53d1447aa8741093dcfd0d..02f7bc29cd72c3ea647e660b039b3e0fe8f5360b 100644 (file)
@@ -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;
        }
 }