[gtk+] wayland/gl: Use the GdkGLContext options



commit 42a895e85e2d48a25e8d15c4ed096610891e5a25
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Jan 28 12:29:37 2015 +0000

    wayland/gl: Use the GdkGLContext options
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741946

 gdk/wayland/gdkglcontext-wayland.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/gdk/wayland/gdkglcontext-wayland.c b/gdk/wayland/gdkglcontext-wayland.c
index a5fa5df..88d3223 100644
--- a/gdk/wayland/gdkglcontext-wayland.c
+++ b/gdk/wayland/gdkglcontext-wayland.c
@@ -110,14 +110,34 @@ gdk_wayland_gl_context_realize (GdkGLContext *context,
   GdkGLProfile profile = gdk_gl_context_get_profile (context);
   GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
   EGLContext ctx;
-  EGLint context_attribs[3];
+  EGLint context_attribs[16];
   int i;
 
   i = 0;
   if (profile == GDK_GL_PROFILE_3_2_CORE)
     {
+      int major, minor, flags;
+      gboolean debug_bit, forward_bit;
+
+      gdk_gl_context_get_required_version (context, &major, &minor);
+      debug_bit = gdk_gl_context_get_debug_enabled (context);
+      forward_bit = gdk_gl_context_get_forward_compatible (context);
+
+      flags = 0;
+
+      if (debug_bit)
+        flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
+      if (forward_bit)
+        flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
+
       context_attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
       context_attribs[i++] = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
+      context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION_KHR;
+      context_attribs[i++] = major;
+      context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION_KHR;
+      context_attribs[i++] = minor;
+      context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
+      context_attribs[i++] = flags;
     }
   context_attribs[i++] = EGL_NONE;
 


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