From f59180d073bf1a4e975367860b1f0030dcef3476 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Mon, 2 Nov 2009 01:11:21 +0000 Subject: [PATCH] [cogl_read_pixels] call cogl_flush() before changing glPixelStore state We were previously calling cogl_flush() after setting up the glPixelStore state for calling glReadPixels, but flushing the journal could itself change the glPixelStore state. --- cogl/cogl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cogl/cogl.c b/cogl/cogl.c index 1b2e9c46a..21e5572e8 100644 --- a/cogl/cogl.c +++ b/cogl/cogl.c @@ -820,6 +820,10 @@ cogl_read_pixels (int x, if (!cogl_is_offscreen (draw_buffer)) y = draw_buffer_height - y - height; + /* make sure any batched primitives get emitted to the GL driver before + * issuing our read pixels... */ + cogl_flush (); + /* Setup the pixel store parameters that may have been changed by Cogl */ glPixelStorei (GL_PACK_ALIGNMENT, 4); @@ -829,10 +833,6 @@ cogl_read_pixels (int x, glPixelStorei (GL_PACK_SKIP_ROWS, 0); #endif /* HAVE_COGL_GL */ - /* make sure any batched primitives get emitted to the GL driver before - * issuing our read pixels... */ - cogl_flush (); - glReadPixels (x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); /* NB: All offscreen rendering is done upside down so there is no need