summaryrefslogtreecommitdiffstats
path: root/src/opengl/qwindowsurface_gl.cpp
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond@trolltech.com>2010-01-13 14:53:04 (GMT)
committerTrond Kjernåsen <trond@trolltech.com>2010-01-13 14:53:04 (GMT)
commit7bfc32ca6a462b498b9f349454113cd37f64e89f (patch)
treea224c41e1228f1aa7decda1ed8370e2df66814dc /src/opengl/qwindowsurface_gl.cpp
parent59ee1b9d387468a5a80b5c450aa202d1b33e6bd1 (diff)
downloadQt-7bfc32ca6a462b498b9f349454113cd37f64e89f.zip
Qt-7bfc32ca6a462b498b9f349454113cd37f64e89f.tar.gz
Qt-7bfc32ca6a462b498b9f349454113cd37f64e89f.tar.bz2
Rework how Qt handles GL extensions.
Qt used to store the GL extensions a particular implementation supported in a global cache, which was initialized once and never updated. This could cause problems because different types of context might support different kinds of extensions (e.g. the difference between sw and hw contexts). With this patch, the GL extensions are cached and updated within each QGLContext. It also makes the extension initialization lazy, which saves application initialization costs for embedded platforms. The patch introduces a internal cross platform QGLTemporaryContext class that is used to create a light-weight GL context without going via QGLWidget and friends (QWS and WinCE still have QGLWidget fallbacks for now). Reviewed-by: Kim Reviewed-by: Samuel
Diffstat (limited to 'src/opengl/qwindowsurface_gl.cpp')
-rw-r--r--src/opengl/qwindowsurface_gl.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 8ee4361..7a565e6 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -295,7 +295,6 @@ QGLWindowSurface::QGLWindowSurface(QWidget *window)
: QWindowSurface(window), d_ptr(new QGLWindowSurfacePrivate)
{
Q_ASSERT(window->isTopLevel());
- QGLExtensions::init();
d_ptr->pb = 0;
d_ptr->fbo = 0;
d_ptr->ctx = 0;
@@ -520,7 +519,7 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
glDisable(GL_SCISSOR_TEST);
- if (d_ptr->fbo && (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit)) {
+ if (d_ptr->fbo && (QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit)) {
const int h = d_ptr->fbo->height();
const int sx0 = br.left();
@@ -698,7 +697,7 @@ void QGLWindowSurface::updateGeometry() {
}
if (d_ptr->destructive_swap_buffers
- && (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject)
+ && (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject)
&& (d_ptr->fbo || !d_ptr->tried_fbo)
&& qt_gl_preferGL2Engine())
{
@@ -712,7 +711,7 @@ void QGLWindowSurface::updateGeometry() {
format.setInternalTextureFormat(GLenum(GL_RGBA));
format.setTextureTarget(target);
- if (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit)
+ if (QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit)
format.setSamples(8);
d_ptr->fbo = new QGLFramebufferObject(rect.size(), format);