summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2013-09-23 22:10:17 +0200
committerMarc-André Lureau <marcandre.lureau@gmail.com>2013-09-30 02:19:51 +0200
commita2be67cbfaf20303704ec549313778729190d89b (patch)
tree0771b7e42ea1437905297c12781962deff14347c /client
parentfe72894bb808969ef6c72a4852fa78477e2f77ef (diff)
spicec: use doublebuffer for opengl
This visually reduces glitches without noticeable speed difference. It's also the traditionnal way of doing opengl.
Diffstat (limited to 'client')
-rw-r--r--client/red_window.h2
-rw-r--r--client/screen.cpp1
-rw-r--r--client/x11/platform.cpp2
-rw-r--r--client/x11/red_pixmap_gl.cpp2
-rw-r--r--client/x11/red_window.cpp12
5 files changed, 16 insertions, 3 deletions
diff --git a/client/red_window.h b/client/red_window.h
index dbd0c797..bf59d8b8 100644
--- a/client/red_window.h
+++ b/client/red_window.h
@@ -82,6 +82,8 @@ public:
void set_type_gl();
void unset_type_gl();
+
+ void swap_gl();
#endif
int get_screen_num();
diff --git a/client/screen.cpp b/client/screen.cpp
index a05d5620..e76fd50a 100644
--- a/client/screen.cpp
+++ b/client/screen.cpp
@@ -357,6 +357,7 @@ inline void RedScreen::update_done()
}
layer->on_update_completion(_update_mark - 1);
}
+ _window.swap_gl();
}
inline void RedScreen::update_composit(QRegion& composit_rgn)
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index da6b6342..475ee6a9 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -3224,7 +3224,7 @@ void Platform::init()
int num_configs;
int attrlist[] = {
GLX_RENDER_TYPE, GLX_RGBA_BIT,
- GLX_DOUBLEBUFFER, False,
+ GLX_DOUBLEBUFFER, True,
GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT,
GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR,
GLX_RED_SIZE, 8,
diff --git a/client/x11/red_pixmap_gl.cpp b/client/x11/red_pixmap_gl.cpp
index 693b67d1..1a586286 100644
--- a/client/x11/red_pixmap_gl.cpp
+++ b/client/x11/red_pixmap_gl.cpp
@@ -79,8 +79,6 @@ RedPixmapGL::RedPixmapGL(int width, int height, RedDrawable::Format format,
glXDestroyContext(XPlatform::get_display(), _glcont);
THROW("no GL_EXT_framebuffer_object extension");
}
- glDrawBuffer(GL_FRONT);
- glReadBuffer(GL_FRONT);
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
index 83144a54..b6e11e14 100644
--- a/client/x11/red_window.cpp
+++ b/client/x11/red_window.cpp
@@ -2122,6 +2122,18 @@ void RedWindow::untouch_context()
glXMakeCurrent(x_display, 0, 0);
}
+void RedWindow::swap_gl()
+{
+ PixelsSource_p *pix_source = (PixelsSource_p*)get_opaque();
+ RedGlContext context = pix_source->x_drawable.context;
+
+ if (!context)
+ return;
+
+ glXMakeCurrent(x_display, get_window(), context);
+ glXSwapBuffers(x_display, get_window());
+}
+
void RedWindow::set_type_gl()
{
PixelsSource_p *pix_source = (PixelsSource_p*)get_opaque();