compositor: Use GL_BGRA_EXT for glReadPixels in screenshooter
authorKristian Høgsberg <krh@bitplanet.net>
Tue, 27 Mar 2012 19:25:46 +0000 (15:25 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 27 Mar 2012 19:59:46 +0000 (15:59 -0400)
This needs GL_EXT_read_format_bgra.

src/compositor.c
src/screenshooter.c

index 3b2ebd4..c83731c 100644 (file)
@@ -2321,6 +2321,11 @@ weston_compositor_init(struct weston_compositor *ec, struct wl_display *display)
                return -1;
        }
 
+       if (!strstr(extensions, "GL_EXT_read_format_bgra")) {
+               fprintf(stderr, "GL_EXT_read_format_bgra not available\n");
+               return -1;
+       }
+
        extensions =
                (const char *) eglQueryString(ec->display, EGL_EXTENSIONS);
        if (strstr(extensions, "EGL_WL_bind_wayland_display"))
index 6748645..f9497f7 100644 (file)
@@ -62,7 +62,7 @@ screenshooter_shoot(struct wl_client *client,
 
        glPixelStorei(GL_PACK_ALIGNMENT, 1);
        glReadPixels(0, 0, output->current->width, output->current->height,
-                    GL_RGBA, GL_UNSIGNED_BYTE, tmp);
+                    GL_BGRA_EXT, GL_UNSIGNED_BYTE, tmp);
 
        d = wl_shm_buffer_get_data(buffer);
        s = tmp + stride * (buffer->height - 1);