From ba57f5a6d4f1475ce612187702f6a3994abb3ba8 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 28 Sep 2009 14:04:20 +1000 Subject: QGLContext::drawTexture() is not supported under OpenGL/ES 2.0 Reviewed-by: trustme --- src/opengl/qgl.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 89bd7d4..97a4a73 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2514,6 +2514,8 @@ void qt_add_texcoords_to_array(qreal x1, qreal y1, qreal x2, qreal y2, q_vertexT array[7] = f2vt(y2); } +#if !defined(QT_OPENGL_ES_2) + static void qDrawTextureRect(const QRectF &target, GLint textureWidth, GLint textureHeight, GLenum textureTarget) { q_vertexType tx = f2vt(1); @@ -2542,7 +2544,6 @@ static void qDrawTextureRect(const QRectF &target, GLint textureWidth, GLint tex q_vertexType vertexArray[4*2]; qt_add_rect_to_array(target, vertexArray); -#if !defined(QT_OPENGL_ES_2) glVertexPointer(2, q_vertexTypeEnum, 0, vertexArray); glTexCoordPointer(2, q_vertexTypeEnum, 0, texCoordArray); @@ -2552,18 +2553,22 @@ static void qDrawTextureRect(const QRectF &target, GLint textureWidth, GLint tex glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); -#endif } +#endif // !QT_OPENGL_ES_2 + /*! \since 4.4 Draws the given texture, \a textureId, to the given target rectangle, \a target, in OpenGL model space. The \a textureTarget should be a 2D texture target. + + \note This function is not supported under OpenGL/ES 2.0. */ void QGLContext::drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget) { +#ifndef QT_OPENGL_ES_2 #ifdef QT_OPENGL_ES if (textureTarget != GL_TEXTURE_2D) { qWarning("QGLContext::drawTexture(): texture target must be GL_TEXTURE_2D on OpenGL ES"); @@ -2587,6 +2592,12 @@ void QGLContext::drawTexture(const QRectF &target, GLuint textureId, GLenum text glDisable(textureTarget); glBindTexture(textureTarget, oldTexture); #endif +#else + Q_UNUSED(target); + Q_UNUSED(textureId); + Q_UNUSED(textureTarget); + qWarning("drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget) not supported with OpenGL ES/2.0"); +#endif } #ifdef Q_MAC_COMPAT_GL_FUNCTIONS @@ -2602,6 +2613,8 @@ void QGLContext::drawTexture(const QRectF &target, QMacCompatGLuint textureId, Q Draws the given texture at the given \a point in OpenGL model space. The \a textureTarget should be a 2D texture target. + + \note This function is not supported under OpenGL/ES. */ void QGLContext::drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget) { -- cgit v0.12