[gtk+/wip/ebassi/gles: 10/26] gdk: Use appropriate API on GLES



commit 67cb792f3180b5f4d6dfcdcc9858a916e90a090d
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sat Apr 23 10:11:44 2016 +0100

    gdk: Use appropriate API on GLES
    
    GLES 2.0 does not have (or need) glDrawBuffer, but GLES 3.0 has a vector
    equivalent that we can use instead.

 gdk/gdkgl.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c
index 748e80f..9f7060b 100644
--- a/gdk/gdkgl.c
+++ b/gdk/gdkgl.c
@@ -419,7 +419,22 @@ gdk_cairo_draw_from_gl (cairo_t              *cr,
       glEnable (GL_SCISSOR_TEST);
 
       gdk_window_get_unscaled_size (impl_window, NULL, &unscaled_window_height);
-      glDrawBuffer (GL_BACK);
+
+      if (!gdk_gl_context_get_use_es (paint_context))
+        glDrawBuffer (GL_BACK);
+      else
+        {
+          int maj, min;
+
+          gdk_gl_context_get_version (paint_context, &maj, &min);
+
+          if ((maj * 100 + min) >= 300)
+            {
+              static const GLenum buffers[] = { GL_BACK };
+
+              glDrawBuffers (G_N_ELEMENTS (buffers), buffers);
+            }
+        }
 
 #define FLIP_Y(_y) (unscaled_window_height - (_y))
 


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