summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl.cpp
diff options
context:
space:
mode:
authorTrond Kjernåsen <trond@trolltech.com>2009-10-20 15:51:15 (GMT)
committerTrond Kjernåsen <trond@trolltech.com>2009-10-20 15:53:17 (GMT)
commit84cfe9af5e333872ac67368a6b14c377ceeda8ec (patch)
treeb9866f82ab3688f6b703f3135df6dafce7cb2664 /src/opengl/qgl.cpp
parentbdb67474ece69a987379411f593d0b37c1400746 (diff)
downloadQt-84cfe9af5e333872ac67368a6b14c377ceeda8ec.zip
Qt-84cfe9af5e333872ac67368a6b14c377ceeda8ec.tar.gz
Qt-84cfe9af5e333872ac67368a6b14c377ceeda8ec.tar.bz2
Fixed an assert when running the composition demo on Mac.
We can't create a QGLWidget in the QGLEngineSelector, since it may be called before a QApplication object has been constructed. Reviewed-by: Kim
Diffstat (limited to 'src/opengl/qgl.cpp')
-rw-r--r--src/opengl/qgl.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 97e3dad..6720ae7 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -151,22 +151,6 @@ class QGLEngineSelector
public:
QGLEngineSelector() : engineType(QPaintEngine::MaxUser)
{
-#ifdef Q_WS_MAC
- // The ATI X1600 driver for Mac OS X does not support return
- // values from functions in GLSL. Since working around this in
- // the GL2 engine would require a big, ugly rewrite, we're
- // falling back to the GL 1 engine..
- QGLWidget *tmp = 0;
- if (!QGLContext::currentContext()) {
- tmp = new QGLWidget();
- tmp->makeCurrent();
- }
- if (strstr((char *) glGetString(GL_RENDERER), "X1600"))
- setPreferredPaintEngine(QPaintEngine::OpenGL);
- if (tmp)
- delete tmp;
-#endif
-
}
void setPreferredPaintEngine(QPaintEngine::Type type) {
@@ -175,6 +159,25 @@ public:
}
QPaintEngine::Type preferredPaintEngine() {
+#ifdef Q_WS_MAC
+ // The ATI X1600 driver for Mac OS X does not support return
+ // values from functions in GLSL. Since working around this in
+ // the GL2 engine would require a big, ugly rewrite, we're
+ // falling back to the GL 1 engine..
+ static bool mac_x1600_check_done = false;
+ if (!mac_x1600_check_done) {
+ QGLWidget *tmp = 0;
+ if (!QGLContext::currentContext()) {
+ tmp = new QGLWidget();
+ tmp->makeCurrent();
+ }
+ if (strstr((char *) glGetString(GL_RENDERER), "X1600"))
+ engineType = QPaintEngine::OpenGL;
+ if (tmp)
+ delete tmp;
+ mac_x1600_check_done = true;
+ }
+#endif
if (engineType == QPaintEngine::MaxUser) {
// No user-set engine - use the defaults
#if defined(QT_OPENGL_ES_2)