summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-05-13 08:01:40 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-05-13 08:24:39 (GMT)
commit98bb706b76936dfc88e8d38db39518a3cdf74b30 (patch)
tree12b404957a6a2b6a4d87cbfa7f7ddcd14e34e223 /src/opengl/qgl.cpp
parent3822cd597fc481acb2a4de324c005c23ce8e78cd (diff)
downloadQt-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/qgl.cpp')
-rw-r--r--src/opengl/qgl.cpp33
1 files changed, 21 insertions, 12 deletions
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