diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-05-13 08:01:40 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-05-13 08:24:39 (GMT) |
commit | 98bb706b76936dfc88e8d38db39518a3cdf74b30 (patch) | |
tree | 12b404957a6a2b6a4d87cbfa7f7ddcd14e34e223 /src/opengl | |
parent | 3822cd597fc481acb2a4de324c005c23ce8e78cd (diff) | |
download | Qt-98bb706b76936dfc88e8d38db39518a3cdf74b30.zip Qt-98bb706b76936dfc88e8d38db39518a3cdf74b30.tar.gz Qt-98bb706b76936dfc88e8d38db39518a3cdf74b30.tar.bz2 |
Enabled compilation of both GL and GL2 paint engine.
Compile both GL and GL2 paint engine on desktop, and choose between them
at run-time based on GL version flags.
Reviewed-by: Tom
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qglgradientcache.cpp | 8 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qglgradientcache_p.h | 4 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 22 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 16 | ||||
-rw-r--r-- | src/opengl/opengl.pro | 29 | ||||
-rw-r--r-- | src/opengl/qgl.cpp | 33 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 15 | ||||
-rw-r--r-- | src/opengl/qglframebufferobject.cpp | 18 | ||||
-rw-r--r-- | src/opengl/qglpixelbuffer.cpp | 19 | ||||
-rw-r--r-- | src/opengl/qglpixmapfilter.cpp | 15 | ||||
-rw-r--r-- | src/opengl/qpaintengine_opengl.cpp | 32 | ||||
-rw-r--r-- | src/opengl/qpixmapdata_gl.cpp | 4 | ||||
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 18 |
13 files changed, 109 insertions, 124 deletions
diff --git a/src/opengl/gl2paintengineex/qglgradientcache.cpp b/src/opengl/gl2paintengineex/qglgradientcache.cpp index b4591b2..59d4bf8 100644 --- a/src/opengl/gl2paintengineex/qglgradientcache.cpp +++ b/src/opengl/gl2paintengineex/qglgradientcache.cpp @@ -44,7 +44,7 @@ #include "qglgradientcache_p.h" -void QGLGradientCache::cleanCache() { +void QGL2GradientCache::cleanCache() { QGLGradientColorTableHash::const_iterator it = cache.constBegin(); for (; it != cache.constEnd(); ++it) { const CacheInfo &cache_info = it.value(); @@ -53,7 +53,7 @@ void QGLGradientCache::cleanCache() { cache.clear(); } -GLuint QGLGradientCache::getBuffer(const QGradient &gradient, qreal opacity, const QGLContext *ctx) +GLuint QGL2GradientCache::getBuffer(const QGradient &gradient, qreal opacity, const QGLContext *ctx) { if (buffer_ctx && !qgl_share_reg()->checkSharing(buffer_ctx, ctx)) cleanCache(); @@ -84,7 +84,7 @@ GLuint QGLGradientCache::getBuffer(const QGradient &gradient, qreal opacity, con } -GLuint QGLGradientCache::addCacheElement(quint64 hash_val, const QGradient &gradient, qreal opacity) +GLuint QGL2GradientCache::addCacheElement(quint64 hash_val, const QGradient &gradient, qreal opacity) { if (cache.size() == maxCacheSize()) { int elem_to_remove = qrand() % maxCacheSize(); @@ -129,7 +129,7 @@ static inline uint qtToGlColor(uint c) } //TODO: Let GL generate the texture using an FBO -void QGLGradientCache::generateGradientColorTable(const QGradient& gradient, uint *colorTable, int size, qreal opacity) const +void QGL2GradientCache::generateGradientColorTable(const QGradient& gradient, uint *colorTable, int size, qreal opacity) const { int pos = 0; QGradientStops s = gradient.stops(); diff --git a/src/opengl/gl2paintengineex/qglgradientcache_p.h b/src/opengl/gl2paintengineex/qglgradientcache_p.h index 346ea13..6acaa00 100644 --- a/src/opengl/gl2paintengineex/qglgradientcache_p.h +++ b/src/opengl/gl2paintengineex/qglgradientcache_p.h @@ -54,7 +54,7 @@ #include <QObject> #include <QtOpenGL> -class QGLGradientCache : public QObject +class QGL2GradientCache : public QObject { Q_OBJECT struct CacheInfo @@ -71,7 +71,7 @@ class QGLGradientCache : public QObject typedef QMultiHash<quint64, CacheInfo> QGLGradientColorTableHash; public: - QGLGradientCache() : QObject(), buffer_ctx(0) + QGL2GradientCache() : QObject(), buffer_ctx(0) { /* connect(QGLSignalProxy::instance(), diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 1c0d7e0..9f2384d 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -240,7 +240,7 @@ void QGL2PaintEngineExPrivate::useSimpleShader() } -Q_GLOBAL_STATIC(QGLGradientCache, qt_opengl_gradient_cache) +Q_GLOBAL_STATIC(QGL2GradientCache, qt_opengl_gradient_cache) void QGL2PaintEngineExPrivate::updateBrushTexture() { @@ -941,7 +941,7 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem Q_D(QGL2PaintEngineEx); ensureActive(); - QOpenGLPaintEngineState *s = state(); + QOpenGL2PaintEngineState *s = state(); const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); @@ -967,7 +967,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextIte transferMode(TextDrawingMode); Q_Q(QGL2PaintEngineEx); - QOpenGLPaintEngineState *s = q->state(); + QOpenGL2PaintEngineState *s = q->state(); QVarLengthArray<QFixedPoint> positions; QVarLengthArray<glyph_t> glyphs; @@ -1364,9 +1364,9 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state) Q_D(QGL2PaintEngineEx); - QOpenGLPaintEngineState *s = static_cast<QOpenGLPaintEngineState *>(new_state); + QOpenGL2PaintEngineState *s = static_cast<QOpenGL2PaintEngineState *>(new_state); - QOpenGLPaintEngineState *old_state = state(); + QOpenGL2PaintEngineState *old_state = state(); const bool needsDepthClipUpdate = !old_state || s->clipEnabled != old_state->clipEnabled || (s->clipEnabled && s->clipRegion != old_state->clipRegion); @@ -1386,28 +1386,28 @@ void QGL2PaintEngineEx::setState(QPainterState *new_state) QPainterState *QGL2PaintEngineEx::createState(QPainterState *orig) const { - QOpenGLPaintEngineState *s; + QOpenGL2PaintEngineState *s; if (!orig) - s = new QOpenGLPaintEngineState(); + s = new QOpenGL2PaintEngineState(); else - s = new QOpenGLPaintEngineState(*static_cast<QOpenGLPaintEngineState *>(orig)); + s = new QOpenGL2PaintEngineState(*static_cast<QOpenGL2PaintEngineState *>(orig)); return s; } -QOpenGLPaintEngineState::QOpenGLPaintEngineState(QOpenGLPaintEngineState &other) +QOpenGL2PaintEngineState::QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &other) : QPainterState(other) { clipRegion = other.clipRegion; hasClipping = other.hasClipping; } -QOpenGLPaintEngineState::QOpenGLPaintEngineState() +QOpenGL2PaintEngineState::QOpenGL2PaintEngineState() { hasClipping = false; } -QOpenGLPaintEngineState::~QOpenGLPaintEngineState() +QOpenGL2PaintEngineState::~QOpenGL2PaintEngineState() { } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index b31f685..76a4fe0 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -58,12 +58,12 @@ class QGL2PaintEngineExPrivate; -class QOpenGLPaintEngineState : public QPainterState +class QOpenGL2PaintEngineState : public QPainterState { public: - QOpenGLPaintEngineState(QOpenGLPaintEngineState &other); - QOpenGLPaintEngineState(); - ~QOpenGLPaintEngineState(); + QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &other); + QOpenGL2PaintEngineState(); + ~QOpenGL2PaintEngineState(); QRegion clipRegion; bool hasClipping; @@ -107,11 +107,11 @@ public: // State stuff is just for clipping and ripped off from QGLPaintEngine void setState(QPainterState *s); QPainterState *createState(QPainterState *orig) const; - inline QOpenGLPaintEngineState *state() { - return static_cast<QOpenGLPaintEngineState *>(QPaintEngineEx::state()); + inline QOpenGL2PaintEngineState *state() { + return static_cast<QOpenGL2PaintEngineState *>(QPaintEngineEx::state()); } - inline const QOpenGLPaintEngineState *state() const { - return static_cast<const QOpenGLPaintEngineState *>(QPaintEngineEx::state()); + inline const QOpenGL2PaintEngineState *state() const { + return static_cast<const QOpenGL2PaintEngineState *>(QPaintEngineEx::state()); } void updateClipRegion(const QRegion &clipRegion, Qt::ClipOperation op); diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index cfa9e4f..7eb2503 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -37,24 +37,21 @@ SOURCES += qgl.cpp \ qglpixmapfilter.cpp \ qglshaderprogram.cpp -#!contains(QT_CONFIG, opengles2) { -# HEADERS += qpaintengine_opengl_p.h -# SOURCES += qpaintengine_opengl.cpp -#} +!contains(QT_CONFIG, opengles2) { + HEADERS += qpaintengine_opengl_p.h + SOURCES += qpaintengine_opengl.cpp +} -#contains(QT_CONFIG, opengles2) { - SOURCES += gl2paintengineex/qglgradientcache.cpp \ - gl2paintengineex/qglengineshadermanager.cpp \ - gl2paintengineex/qgl2pexvertexarray.cpp \ - gl2paintengineex/qpaintengineex_opengl2.cpp - - HEADERS += gl2paintengineex/qglgradientcache_p.h \ - gl2paintengineex/qglengineshadermanager_p.h \ - gl2paintengineex/qgl2pexvertexarray_p.h \ - gl2paintengineex/qpaintengineex_opengl2_p.h \ - gl2paintengineex/qglengineshadersource_p.h -#} +SOURCES += gl2paintengineex/qglgradientcache.cpp \ + gl2paintengineex/qglengineshadermanager.cpp \ + gl2paintengineex/qgl2pexvertexarray.cpp \ + gl2paintengineex/qpaintengineex_opengl2.cpp +HEADERS += gl2paintengineex/qglgradientcache_p.h \ + gl2paintengineex/qglengineshadermanager_p.h \ + gl2paintengineex/qgl2pexvertexarray_p.h \ + gl2paintengineex/qpaintengineex_opengl2_p.h \ + gl2paintengineex/qglengineshadersource_p.h x11 { contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles1cl)|contains(QT_CONFIG, opengles2) { diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index ccb6080..779ed9a 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -65,9 +65,9 @@ #include "qimage.h" #include "qgl_p.h" -#if 1 || defined(QT_OPENGL_ES_2) #include "gl2paintengineex/qpaintengineex_opengl2_p.h" -#else + +#ifndef QT_OPENGL_ES_2 #include <private/qpaintengine_opengl_p.h> #endif @@ -2125,9 +2125,6 @@ void QGLContext::deleteTexture(QMacCompatGLuint id) } #endif -// qpaintengine_opengl.cpp -#if !defined(QT_OPENGL_ES_2) -//extern void qt_add_rect_to_array(const QRectF &r, q_vertexType *array); void qt_add_rect_to_array(const QRectF &r, q_vertexType *array) { qreal left = r.left(); @@ -2145,9 +2142,17 @@ void qt_add_rect_to_array(const QRectF &r, q_vertexType *array) array[7] = f2vt(bottom); } -#else -void qt_add_rect_to_array(const QRectF &r, q_vertexType *array) {}; -#endif +void qt_add_texcoords_to_array(qreal x1, qreal y1, qreal x2, qreal y2, q_vertexType *array) +{ + array[0] = f2vt(x1); + array[1] = f2vt(y1); + array[2] = f2vt(x2); + array[3] = f2vt(y1); + array[4] = f2vt(x2); + array[5] = f2vt(y2); + array[6] = f2vt(x1); + array[7] = f2vt(y2); +} static void qDrawTextureRect(const QRectF &target, GLint textureWidth, GLint textureHeight, GLenum textureTarget) { @@ -4154,9 +4159,9 @@ void QGLWidget::drawTexture(const QPointF &point, QMacCompatGLuint textureId, QM } #endif -#if 1 || defined(QT_OPENGL_ES_2) -Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_gl_engine) -#else +Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_gl_2_engine) + +#ifndef QT_OPENGL_ES_2 Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_gl_engine) #endif @@ -4179,7 +4184,11 @@ Q_OPENGL_EXPORT QPaintEngine* qt_qgl_paint_engine() */ QPaintEngine *QGLWidget::paintEngine() const { - return qt_gl_engine(); +#ifndef QT_OPENGL_ES_2 + if (!qt_gl_preferGL2Engine()) + return qt_gl_engine(); +#endif + return qt_gl_2_engine(); } #ifdef QT3_SUPPORT diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index f7b9392..1513ee8 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -419,6 +419,17 @@ extern QOpenGLPaintEngine* qt_qgl_paint_engine(); extern EGLDisplay qt_qgl_egl_display(); #endif +inline bool qt_gl_preferGL2Engine() +{ +#if defined(QT_OPENGL_ES_2) + return true; +#else + QGLFormat::OpenGLVersionFlags flags = QGLFormat::openGLVersionFlags(); + bool hasOpenGL2 = (flags & QGLFormat::OpenGL_Version_2_0); + return hasOpenGL2 && qgetenv("QT_GL_NO_OPENGL2ENGINE").isEmpty(); +#endif +} + inline GLenum qt_gl_preferredTextureFormat() { return QSysInfo::ByteOrder == QSysInfo::BigEndian ? GL_RGBA : GL_BGRA; @@ -426,16 +437,16 @@ inline GLenum qt_gl_preferredTextureFormat() inline GLenum qt_gl_preferredTextureTarget() { -#if 1 || defined(QT_OPENGL_ES_2) +#if defined(QT_OPENGL_ES_2) return GL_TEXTURE_2D; #else return (QGLExtensions::glExtensions & QGLExtensions::TextureRectangle) + && !qt_gl_preferGL2Engine() ? GL_TEXTURE_RECTANGLE_NV : GL_TEXTURE_2D; #endif } - QT_END_NAMESPACE #endif // QGL_P_H diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index aa5dfc5..87e0dda 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -43,11 +43,12 @@ #include <qdebug.h> #include <private/qgl_p.h> -#if 1 || defined(QT_OPENGL_ES_2) #include <private/qpaintengineex_opengl2_p.h> -#else + +#ifndef QT_OPENGL_ES_2 #include <private/qpaintengine_opengl_p.h> #endif + #include <qglframebufferobject.h> #include <qlibrary.h> #include <qimage.h> @@ -896,17 +897,20 @@ QImage QGLFramebufferObject::toImage() const return image; } -#if 1 || defined(QT_OPENGL_ES_2) -Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_buffer_paintengine) -#else -Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_buffer_paintengine) +Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_buffer_2_engine) + +#ifndef QT_OPENGL_ES_2 +Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_buffer_engine) #endif /*! \reimp */ QPaintEngine *QGLFramebufferObject::paintEngine() const { #if !defined(QT_OPENGL_ES_2) - return qt_buffer_paintengine(); + if (qt_gl_preferGL2Engine()) + return qt_buffer_2_engine(); + else + return qt_buffer_engine(); #else return 0; #endif diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp index 6a207c8..cb24177 100644 --- a/src/opengl/qglpixelbuffer.cpp +++ b/src/opengl/qglpixelbuffer.cpp @@ -81,15 +81,15 @@ #include <private/qglpixelbuffer_p.h> #include <qimage.h> -#if 1 || defined(QT_OPENGL_ES_2) #include <private/qpaintengineex_opengl2_p.h> -#else + +#ifndef QT_OPENGL_ES_2 #include <private/qpaintengine_opengl_p.h> #endif QT_BEGIN_NAMESPACE -#if 0 && !defined(QT_OPENGL_ES_2) +#if !defined(QT_OPENGL_ES_2) extern void qgl_cleanup_glyph_cache(QGLContext *); #else void qgl_cleanup_glyph_cache(QGLContext *) {} @@ -365,17 +365,20 @@ bool QGLPixelBuffer::isValid() const return !d->invalid; } -#if 1 || defined(QT_OPENGL_ES_2) -Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_buffer_paintengine) -#else -Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_buffer_paintengine) +Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_buffer_2_engine) + +#ifndef QT_OPENGL_ES_2 +Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_buffer_engine) #endif /*! \reimp */ QPaintEngine *QGLPixelBuffer::paintEngine() const { #if !defined(QT_OPENGL_ES_2) - return qt_buffer_paintengine(); + if (qt_gl_preferGL2Engine()) + return qt_buffer_2_engine(); + else + return qt_buffer_engine(); #else return 0; #endif diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp index 5d4d5bf..eb3298b 100644 --- a/src/opengl/qglpixmapfilter.cpp +++ b/src/opengl/qglpixmapfilter.cpp @@ -116,21 +116,8 @@ QPixmapFilter *QGLContextPrivate::createPixmapFilter(int type) const return 0; } -#if !defined(QT_OPENGL_ES_2) extern void qt_add_rect_to_array(const QRectF &r, q_vertexType *array); -//extern void qt_add_texcoords_to_array(qreal x1, qreal y1, qreal x2, qreal y2, q_vertexType *array); -void qt_add_texcoords_to_array(qreal x1, qreal y1, qreal x2, qreal y2, q_vertexType *array) -{ - array[0] = f2vt(x1); - array[1] = f2vt(y1); - array[2] = f2vt(x2); - array[3] = f2vt(y1); - array[4] = f2vt(x2); - array[5] = f2vt(y2); - array[6] = f2vt(x1); - array[7] = f2vt(y2); -} -#endif +extern void qt_add_texcoords_to_array(qreal x1, qreal y1, qreal x2, qreal y2, q_vertexType *array); static void qgl_drawTexture(const QRectF &rect, int tx_width, int tx_height, const QRectF & src) { diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 612168e..9197ebc 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -123,35 +123,6 @@ struct QT_PointF { qreal y; }; -void qt_add_rect_to_array(const QRectF &r, q_vertexType *array) -{ - qreal left = r.left(); - qreal right = r.right(); - qreal top = r.top(); - qreal bottom = r.bottom(); - - array[0] = f2vt(left); - array[1] = f2vt(top); - array[2] = f2vt(right); - array[3] = f2vt(top); - array[4] = f2vt(right); - array[5] = f2vt(bottom); - array[6] = f2vt(left); - array[7] = f2vt(bottom); -} - -void qt_add_texcoords_to_array(qreal x1, qreal y1, qreal x2, qreal y2, q_vertexType *array) -{ - array[0] = f2vt(x1); - array[1] = f2vt(y1); - array[2] = f2vt(x2); - array[3] = f2vt(y1); - array[4] = f2vt(x2); - array[5] = f2vt(y2); - array[6] = f2vt(x1); - array[7] = f2vt(y2); -} - struct QGLTrapezoid { QGLTrapezoid() @@ -3124,6 +3095,9 @@ QGLTrapezoidMaskGenerator::QGLTrapezoidMaskGenerator(const QPainterPath &path, c { } +extern void qt_add_rect_to_array(const QRectF &r, q_vertexType *array); +extern void qt_add_texcoords_to_array(qreal x1, qreal y1, qreal x2, qreal y2, q_vertexType *array); + void QGLTrapezoidMaskGenerator::drawMask(const QRect &rect) { #ifdef QT_OPENGL_ES diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index cb0b4d1..89e6749 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -49,11 +49,7 @@ #include <private/qgl_p.h> #include <private/qdrawhelper_p.h> -#if 1 || defined(QT_OPENGL_ES_2) #include <private/qpaintengineex_opengl2_p.h> -#else -#include <private/qpaintengine_opengl_p.h> -#endif QT_BEGIN_NAMESPACE diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 576da12..2f111f4 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -69,9 +69,10 @@ #include <private/qglpixelbuffer_p.h> #include <private/qgraphicssystem_gl_p.h> -#if 1 || defined(QT_OPENGL_ES_2) + #include <private/qpaintengineex_opengl2_p.h> -#else + +#ifndef QT_OPENGL_ES_2 #include <private/qpaintengine_opengl_p.h> #endif @@ -292,17 +293,20 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) qDebug() << "hijackWindow() context created for" << widget << d_ptr->contexts.size(); } -#if 1 || defined(QT_OPENGL_ES_2) -Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_gl_window_surface_paintengine) -#else -Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_gl_window_surface_paintengine) +Q_GLOBAL_STATIC(QGL2PaintEngineEx, qt_gl_window_surface_2_engine) + +#ifndef QT_OPENGL_ES_2 +Q_GLOBAL_STATIC(QOpenGLPaintEngine, qt_gl_window_surface_engine) #endif /*! \reimp */ QPaintEngine *QGLWindowSurface::paintEngine() const { #if !defined(QT_OPENGL_ES_2) - return qt_gl_window_surface_paintengine(); + if (qt_gl_preferGL2Engine()) + return qt_gl_window_surface_2_engine(); + else + return qt_gl_window_surface_engine(); #else return 0; #endif |