mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-03 07:02:25 +00:00
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:
parent
fe72894bb8
commit
a2be67cbfa
@ -82,6 +82,8 @@ public:
|
||||
|
||||
void set_type_gl();
|
||||
void unset_type_gl();
|
||||
|
||||
void swap_gl();
|
||||
#endif
|
||||
|
||||
int get_screen_num();
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user