diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-04-16 08:55:12 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-04-16 15:28:26 (GMT) |
commit | a241ebac49f01ba0e26a177f1aadbd18c7e9cae7 (patch) | |
tree | c7e577ecf60c990a1a5a1902ba0637bd3187a4d6 /src/opengl/qwindowsurface_gl.cpp | |
parent | 1e1371e19ae62a5bf57dcad8d53ac70dcd2ad0cb (diff) | |
download | Qt-a241ebac49f01ba0e26a177f1aadbd18c7e9cae7.zip Qt-a241ebac49f01ba0e26a177f1aadbd18c7e9cae7.tar.gz Qt-a241ebac49f01ba0e26a177f1aadbd18c7e9cae7.tar.bz2 |
Use FBOs as pixmap backend in GL graphics system.
We now use FBOs to implement render-to-pixmap for the GL pixmap backend.
A multisample FBO is used for rendering, and is then blitted onto a
non-multisample FBO dynamically bound to the relevant texture.
Reviewed-by: Tom
Diffstat (limited to 'src/opengl/qwindowsurface_gl.cpp')
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index c9d23d1..e0078bb 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -100,8 +100,8 @@ QGLGraphicsSystem::QGLGraphicsSystem() int i = 0; int spec[16]; spec[i++] = GLX_RGBA; -#if 0 spec[i++] = GLX_DOUBLEBUFFER; +#if 0 spec[i++] = GLX_DEPTH_SIZE; spec[i++] = 8; spec[i++] = GLX_STENCIL_SIZE; @@ -433,19 +433,35 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & size = parent->size(); } - ctx->makeCurrent(); -#ifdef Q_WS_MAC - ctx->updatePaintDevice(); -#endif - glDisable(GL_DEPTH_TEST); glDisable(GL_SCISSOR_TEST); if (d_ptr->fbo && QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit) { - QGLFramebufferObject::blitFramebuffer(0, rect, d_ptr->fbo, rect); - d_ptr->fbo->bind(); + const int h = d_ptr->fbo->height(); + + const int x0 = rect.left(); + const int x1 = rect.left() + rect.width(); + const int y0 = h - (rect.top() + rect.height()); + const int y1 = h - rect.top(); + + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0); + + glBlitFramebufferEXT(x0, y0, x1, y1, + x0, y0, x1, y1, + GL_COLOR_BUFFER_BIT, + GL_NEAREST); + + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, d_ptr->fbo->handle()); } else { - if (d_ptr->fbo) + glDisable(GL_DEPTH_TEST); + + if (d_ptr->fbo) { d_ptr->fbo->release(); + } else { + ctx->makeCurrent(); +#ifdef Q_WS_MAC + ctx->updatePaintDevice(); +#endif + } glMatrixMode(GL_MODELVIEW); glLoadIdentity(); |