Use GL_NEAREST filter in the draw-and-read get_data texture fallback
authorNeil Roberts <neil@linux.intel.com>
Thu, 8 Jul 2010 17:31:29 +0000 (18:31 +0100)
committerNeil Roberts <neil@linux.intel.com>
Fri, 9 Jul 2010 10:14:15 +0000 (11:14 +0100)
The fallback for when glGetTexImage is not available renders the
texture to the framebuffer to read the data using glReadPixels. This
patch just sets the COGL_MATERIAL_FILTER_NEAREST filter mode on the
material before rendering to avoid linear filtering which would alter
the texture data.

clutter/cogl/cogl/cogl-texture.c

index a2092f9..8f2b3e2 100644 (file)
@@ -1060,6 +1060,10 @@ _cogl_texture_draw_and_read (CoglHandle   handle,
                                    "RGBA = REPLACE (TEXTURE)",
                                    NULL);
 
+  cogl_material_set_layer_filters (ctx->texture_download_material, 0,
+                                   COGL_MATERIAL_FILTER_NEAREST,
+                                   COGL_MATERIAL_FILTER_NEAREST);
+
   do_texture_draw_and_read (handle, target_bmp, viewport);
 
   /* Check whether texture has alpha and framebuffer not */