summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl_qws.cpp
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-09-10 22:30:20 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-09-10 22:30:20 (GMT)
commit7c52bd0b28eaf0b1d5435fda6140a9d05fddba19 (patch)
tree0c2e4613748a62d9cc4810a0b1dfdf2a42e43c40 /src/opengl/qgl_qws.cpp
parent80c11987819a2451ebecefc5b2bf1b42ad4499ae (diff)
downloadQt-7c52bd0b28eaf0b1d5435fda6140a9d05fddba19.zip
Qt-7c52bd0b28eaf0b1d5435fda6140a9d05fddba19.tar.gz
Qt-7c52bd0b28eaf0b1d5435fda6140a9d05fddba19.tar.bz2
Make an EGL context current when initializing GL extensions
Reviewed-by: trustme
Diffstat (limited to 'src/opengl/qgl_qws.cpp')
-rw-r--r--src/opengl/qgl_qws.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp
index c71ceeb..759f9de 100644
--- a/src/opengl/qgl_qws.cpp
+++ b/src/opengl/qgl_qws.cpp
@@ -41,6 +41,7 @@
#include "qgl.h"
#include "qgl_egl_p.h"
+#include "qglpixelbuffer.h"
#include <qglscreen_qws.h>
#include <qscreenproxy_qws.h>
@@ -411,7 +412,29 @@ void QGLExtensions::init()
if (init_done)
return;
init_done = true;
+
+ // We need a context current to initialize the extensions,
+ // but getting a valid EGLNativeWindowType this early can be
+ // problematic under QWS. So use a pbuffer instead.
+ //
+ // Unfortunately OpenGL/ES 2.0 systems don't normally
+ // support pbuffers, so we have no choice but to try
+ // our luck with a window on those systems.
+#if defined(QT_OPENGL_ES_2)
+ QGLWidget tmpWidget;
+ tmpWidget.makeCurrent();
+
init_extensions();
+
+ tmpWidget.doneCurrent();
+#else
+ QGLPixelBuffer pbuffer(16, 16);
+ pbuffer.makeCurrent();
+
+ init_extensions();
+
+ pbuffer.doneCurrent();
+#endif
}
QT_END_NAMESPACE