[gtk+/wip/gdk-gl: 29/31] gdk: Add GdkGLPixelFormat:stereo
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/gdk-gl: 29/31] gdk: Add GdkGLPixelFormat:stereo
- Date: Thu, 14 Aug 2014 11:14:45 +0000 (UTC)
commit fb996eec50011a0bb7b7330cf038f97e505ef5ca
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Aug 14 11:30:20 2014 +0100
gdk: Add GdkGLPixelFormat:stereo
Missing pixel format attribute for stereoscopic buffers.
gdk/gdkglpixelformat.c | 27 +++++++++++++++++++++++++++
gdk/gdkglpixelformatprivate.h | 1 +
gdk/x11/gdkglcontext-x11.c | 6 ++++++
3 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkglpixelformat.c b/gdk/gdkglpixelformat.c
index 2ca08a2..181dd71 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 d83e39e..803e5c9 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 e6bf166..2e0dc5e 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]