[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.
This commit is contained in:
Robert Bragg 2009-11-02 01:11:21 +00:00
parent d1de286109
commit f59180d073

View File

@ -820,6 +820,10 @@ cogl_read_pixels (int x,
if (!cogl_is_offscreen (draw_buffer)) if (!cogl_is_offscreen (draw_buffer))
y = draw_buffer_height - y - height; 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 /* Setup the pixel store parameters that may have been changed by
Cogl */ Cogl */
glPixelStorei (GL_PACK_ALIGNMENT, 4); glPixelStorei (GL_PACK_ALIGNMENT, 4);
@ -829,10 +833,6 @@ cogl_read_pixels (int x,
glPixelStorei (GL_PACK_SKIP_ROWS, 0); glPixelStorei (GL_PACK_SKIP_ROWS, 0);
#endif /* HAVE_COGL_GL */ #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); glReadPixels (x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
/* NB: All offscreen rendering is done upside down so there is no need /* NB: All offscreen rendering is done upside down so there is no need