[gtk+/wip/ebassi/gles: 7/10] glarea: Use the appropriate texture format for GLES



commit b45c7b508bd7be1ec6c0d589a14a783133adb0a2
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Apr 25 12:28:41 2016 +0100

    glarea: Use the appropriate texture format for GLES
    
    The core OpenGL ES spec does not have GL_BGRA, so we need to make do
    with GL_RGBA and live with the format conversion.

 gtk/gtkglarea.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c
index 4803886..094378e 100644
--- a/gtk/gtkglarea.c
+++ b/gtk/gtkglarea.c
@@ -458,7 +458,11 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area)
       glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
       glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
       glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-      glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
+
+      if (gdk_gl_context_get_use_es (priv->context))
+        glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+      else
+        glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
     }
 
   if (priv->render_buffer)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]