diff options
author | Trond Kjernåsen <trond@trolltech.com> | 2010-01-13 14:53:04 (GMT) |
---|---|---|
committer | Trond Kjernåsen <trond@trolltech.com> | 2010-01-13 14:53:04 (GMT) |
commit | 7bfc32ca6a462b498b9f349454113cd37f64e89f (patch) | |
tree | a224c41e1228f1aa7decda1ed8370e2df66814dc /src/opengl/qgl_wince.cpp | |
parent | 59ee1b9d387468a5a80b5c450aa202d1b33e6bd1 (diff) | |
download | Qt-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/qgl_wince.cpp')
-rw-r--r-- | src/opengl/qgl_wince.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/opengl/qgl_wince.cpp b/src/opengl/qgl_wince.cpp index 460f10d..00a125a 100644 --- a/src/opengl/qgl_wince.cpp +++ b/src/opengl/qgl_wince.cpp @@ -95,8 +95,27 @@ public: #include <qcolor.h> +/* + QGLTemporaryContext implementation +*/ +class QGLTemporaryContextPrivate +{ +public: + QGLWidget *widget; +}; +QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) + : d(new QGLTemporaryContextPrivate) +{ + d->widget = new QGLWidget; + d->widget->makeCurrent(); +} + +QGLTemporaryContext::~QGLTemporaryContext() +{ + delete d->widget; +} /***************************************************************************** QGLFormat Win32/WGL-specific code @@ -627,21 +646,4 @@ void QGLWidget::setColormap(const QGLColormap & c) } } -void QGLExtensions::init() -{ - static bool init_done = false; - - if (init_done) - return; - init_done = true; - - // We need a context current to initialize the extensions. - QGLWidget tmpWidget; - tmpWidget.makeCurrent(); - - init_extensions(); - - tmpWidget.doneCurrent(); -} - QT_END_NAMESPACE |