summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cogl/cogl/driver/gl/gles/cogl-driver-gles.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
index 26607e096..562bcbe24 100644
--- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
+++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
@@ -87,10 +87,17 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
gltype = GL_UNSIGNED_BYTE;
break;
- /* GLES doesn't have GL_RED, so use GL_ALPHA and use a swizzle later */
case COGL_PIXEL_FORMAT_R_8:
- glintformat = GL_ALPHA;
- glformat = GL_ALPHA;
+ if (cogl_has_feature (context, COGL_FEATURE_ID_TEXTURE_RG))
+ {
+ glintformat = GL_RED;
+ glformat = GL_R8;
+ }
+ else
+ {
+ glintformat = GL_LUMINANCE;
+ glformat = GL_LUMINANCE;
+ }
gltype = GL_UNSIGNED_BYTE;
break;