[gtk+/wip/gdk-gl] glarea: Temporarily disable double-buffering
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/gdk-gl] glarea: Temporarily disable double-buffering
- Date: Mon, 18 Aug 2014 17:09:29 +0000 (UTC)
commit a8b172b8038302fb08a4b517f4fe58ce44d86710
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Aug 18 18:01:34 2014 +0100
glarea: Temporarily disable double-buffering
Double-buffering inside GDK breaks the GL drawing model; GL expects to
handle the output surface in its own way, so the double buffering done
by GTK produces flickering and bad frames.
We need to teach to GDK to ignore windows with native surfaces
associated with a GdkGLContext, while still allowing the ability to draw
with Cairo on a valid surface, but that requires some serious rework of
the drawing code.
gtk/gtkglarea.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c
index 5dec12c..00f0cf5 100644
--- a/gtk/gtkglarea.c
+++ b/gtk/gtkglarea.c
@@ -347,6 +347,9 @@ gtk_gl_area_draw (GtkWidget *widget,
g_signal_emit (self, area_signals[RENDER], 0, priv->context, &unused);
+ /* XXX: this will go away once gdk_window_end_paint() knows about
+ * GdkGLContext and calls it implicitly when needed
+ */
gtk_gl_area_flush_buffer (self);
return TRUE;
@@ -524,6 +527,18 @@ gtk_gl_area_init (GtkGLArea *self)
{
gtk_widget_set_has_window (GTK_WIDGET (self), TRUE);
gtk_widget_set_app_paintable (GTK_WIDGET (self), TRUE);
+
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ /* FIXME: we need this because double buffering inside GDK will
+ * clear the GL drawable we use, which means flickering. the
+ * proper way to fix this is to make GDK understand that a GDK
+ * window backed by a native window with a GL context will draw
+ * on the window itself, and that all the other drawing should
+ * happen on a seperate surface, which will then get blended via
+ * GL.
+ */
+ gtk_widget_set_double_buffered (GTK_WIDGET (self), FALSE);
+ G_GNUC_END_IGNORE_DEPRECATIONS
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]