gdk: Add GdkGLPixelFormat:stereo

Missing pixel format attribute for stereoscopic buffers.
This commit is contained in:
Emmanuele Bassi
2014-08-14 11:30:20 +01:00
parent cf0b1771da
commit fb996eec50
3 changed files with 34 additions and 0 deletions

View File

@@ -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;
@@ -288,6 +297,22 @@ gdk_gl_pixel_format_class_init (GdkGLPixelFormatClass *klass)
G_PARAM_CONSTRUCT_ONLY |
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:
*
@@ -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)

View File

@@ -35,6 +35,7 @@ struct _GdkGLPixelFormat
gboolean double_buffer;
gboolean multi_sample;
gboolean stereo;
int aux_buffers;
int color_size;

View File

@@ -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;