summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2014-08-14 11:30:20 +0100
committerEmmanuele Bassi <ebassi@gnome.org>2014-08-14 11:30:20 +0100
commitfb996eec50011a0bb7b7330cf038f97e505ef5ca (patch)
tree01ff611875d52d5e7a275037a3067b55bd39a310
parentcf0b1771da029c389ce23f3be7f78b46484bd904 (diff)
downloadgtk+-fb996eec50011a0bb7b7330cf038f97e505ef5ca.tar.gz
gdk: Add GdkGLPixelFormat:stereo
Missing pixel format attribute for stereoscopic buffers.
-rw-r--r--gdk/gdkglpixelformat.c27
-rw-r--r--gdk/gdkglpixelformatprivate.h1
-rw-r--r--gdk/x11/gdkglcontext-x11.c6
3 files changed, 34 insertions, 0 deletions
diff --git a/gdk/gdkglpixelformat.c b/gdk/gdkglpixelformat.c
index 2ca08a2776..181dd71452 100644
--- a/gdk/gdkglpixelformat.c
+++ b/gdk/gdkglpixelformat.c
@@ -104,6 +104,7 @@ enum {
/* bool */
PROP_DOUBLE_BUFFER,
PROP_MULTI_SAMPLE,
+ PROP_STEREO,
/* uint */
PROP_AUX_BUFFERS,
@@ -145,6 +146,10 @@ gdk_gl_pixel_format_set_property (GObject *gobject,
self->multi_sample = g_value_get_boolean (value);
break;
+ case PROP_STEREO:
+ self->stereo = g_value_get_boolean (value);
+ break;
+
case PROP_AUX_BUFFERS:
self->aux_buffers = g_value_get_int (value);
break;
@@ -204,6 +209,10 @@ gdk_gl_pixel_format_get_property (GObject *gobject,
g_value_set_boolean (value, self->multi_sample);
break;
+ case PROP_STEREO:
+ g_value_set_boolean (value, self->stereo);
+ break;
+
case PROP_AUX_BUFFERS:
g_value_set_int (value, self->aux_buffers);
break;
@@ -289,6 +298,22 @@ gdk_gl_pixel_format_class_init (GdkGLPixelFormatClass *klass)
G_PARAM_STATIC_STRINGS);
/**
+ * GdkGLPixelFormat:stereo:
+ *
+ * Whether the pixel format should support stereoscopic buffers.
+ *
+ * Since: 3.14
+ */
+ obj_props[PROP_STEREO] =
+ g_param_spec_boolean ("stereo",
+ P_("Stereo"),
+ P_("Whether the pixel format should support stereoscopic buffers"),
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ /**
* GdkGLPixelFormat:aux-buffers:
*
* A positive integer indicating the number of auxiliary buffers
@@ -518,6 +543,8 @@ GDK_GL_PIXEL_FORMAT_GET (gboolean, double_buffer, FALSE)
GDK_GL_PIXEL_FORMAT_GET (gboolean, multi_sample, FALSE)
+GDK_GL_PIXEL_FORMAT_GET (gboolean, stereo, FALSE)
+
GDK_GL_PIXEL_FORMAT_GET (gint, color_size, 0)
GDK_GL_PIXEL_FORMAT_GET (gint, alpha_size, 0)
diff --git a/gdk/gdkglpixelformatprivate.h b/gdk/gdkglpixelformatprivate.h
index d83e39e21a..803e5c97ef 100644
--- a/gdk/gdkglpixelformatprivate.h
+++ b/gdk/gdkglpixelformatprivate.h
@@ -35,6 +35,7 @@ struct _GdkGLPixelFormat
gboolean double_buffer;
gboolean multi_sample;
+ gboolean stereo;
int aux_buffers;
int color_size;
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index e6bf16687a..2e0dc5efd1 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -318,6 +318,12 @@ get_glx_attributes_for_pixel_format (GdkDisplay *display,
attrs[i++] = GL_TRUE;
}
+ if (format->stereo)
+ {
+ attrs[i++] = GLX_STEREO;
+ attrs[i++] = GL_TRUE;
+ }
+
if (format->color_size < 0)
{
attrs[i++] = GLX_RED_SIZE;