spicec: use doublebuffer for opengl

This visually reduces glitches without noticeable speed difference.

It's also the traditionnal way of doing opengl.
This commit is contained in:
Marc-André Lureau 2013-09-23 22:10:17 +02:00
parent fe72894bb8
commit a2be67cbfa
5 changed files with 16 additions and 3 deletions

View File

@ -82,6 +82,8 @@ public:
void set_type_gl();
void unset_type_gl();
void swap_gl();
#endif
int get_screen_num();

View File

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

View File

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

View File

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

View File

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