diff --git a/lib/kwinglutils.cpp b/lib/kwinglutils.cpp index 0bc02a15e6..d903d17490 100644 --- a/lib/kwinglutils.cpp +++ b/lib/kwinglutils.cpp @@ -153,6 +153,92 @@ void renderGLGeometry( const QRegion& region, int count, const float* vertices, const float* texture, const float* color, int dim, int stride ) { +#ifdef KWIN_HAVE_OPENGLES + int triangleCount = count * 6; + float* triangleVertices = new float[ dim * triangleCount ]; + float* triangleTexCoords = NULL; + float* triangleColors = NULL; + if( texture != NULL ) + { + triangleTexCoords = new float[ 2 * triangleCount ]; + } + if( color != NULL ) + { + triangleColors = new float[ 4 * triangleCount ]; + } + for( int i=0; i 5); @@ -203,11 +289,21 @@ void renderGLGeometry( const QRegion& region, int count, glPopClientAttrib(); glPopAttrib(); } +#endif } void renderGLGeometryImmediate( int count, const float* vertices, const float* texture, const float* color, int dim, int stride ) { +#ifdef KWIN_HAVE_OPENGLES + Q_UNUSED( count ) + Q_UNUSED( vertices ) + Q_UNUSED( texture ) + Q_UNUSED( color ) + Q_UNUSED( dim ) + Q_UNUSED( stride ) + // TODO: OpenGL ES should use a VBO +#else // Find out correct glVertex*fv function according to dim parameter. void ( *glVertexFunc )( const float* ) = glVertex2fv; if( dim == 3 ) @@ -260,6 +356,7 @@ void renderGLGeometryImmediate( int count, const float* vertices, const float* t glVertexFunc( vertices + i*vsize ); } glEnd(); +#endif } void addQuadVertices(QVector& verts, float x1, float y1, float x2, float y2) diff --git a/lib/kwinglutils.h b/lib/kwinglutils.h index a450556a69..f05898d4c6 100644 --- a/lib/kwinglutils.h +++ b/lib/kwinglutils.h @@ -85,6 +85,8 @@ int KWIN_EXPORT nearestPowerOfTwo( int x ); * Note that texture coordinates must match texture type (normalized/unnormalized * for GL_TEXTURE_2D/GL_TEXTURE_ARB). * + * For OpenGL ES each quad is split into two triangles. + * * @param count number of vertices to use. * @param dim number of components per vertex coordinate in vertices array. * @param stride byte offset of consecutive elements in arrays. If 0, then @@ -105,6 +107,8 @@ KWIN_EXPORT void renderGLGeometry( int count, int dim = 2, int stride = 0 ); /** + * In OpenGL ES this method is a no-op. + * * @deprecated Use GLVertexBuffer * @see GLVertexBuffer **/