From 2e2a7948fb8a41bbdb5b18415cd99d10e7c18618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 4 Feb 2011 19:37:31 +0100 Subject: [PATCH] Remove renderGLGeometry from kwinglutils. Not used anymore - completely replaced by VBO. --- lib/kwinglutils.cpp | 119 -------------------------------------------- lib/kwinglutils.h | 38 -------------- 2 files changed, 157 deletions(-) diff --git a/lib/kwinglutils.cpp b/lib/kwinglutils.cpp index 72438b9472..99b648716f 100644 --- a/lib/kwinglutils.cpp +++ b/lib/kwinglutils.cpp @@ -170,125 +170,6 @@ int nearestPowerOfTwo(int x) return 1 << last; } -void renderGLGeometry(int count, const float* vertices, const float* texture, const float* color, - int dim, int stride) -{ - return renderGLGeometry(infiniteRegion(), count, vertices, texture, color, dim, stride); -} - -void renderGLGeometry(const QRegion& region, int count, - const float* vertices, const float* texture, const float* color, - int dim, int stride) -{ -#ifdef KWIN_HAVE_OPENGLES - Q_UNUSED(region) - Q_UNUSED(count) - Q_UNUSED(vertices) - Q_UNUSED(texture) - Q_UNUSED(color) - Q_UNUSED(dim) - Q_UNUSED(stride) -#else - // Using arrays only makes sense if we have larger number of vertices. - // Otherwise overhead of enabling/disabling them is too big. - bool use_arrays = (count > 5); - - if (use_arrays) { - glPushAttrib(GL_ENABLE_BIT); - glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); - // Enable arrays - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(dim, GL_FLOAT, stride, vertices); - if (texture != NULL) { - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(2, GL_FLOAT, stride, texture); - } - if (color != NULL) { - glEnableClientState(GL_COLOR_ARRAY); - glColorPointer(4, GL_FLOAT, stride, color); - } - } - - // Clip using scissoring - if (!effects->isRenderTargetBound()) { - PaintClipper pc(region); - for (PaintClipper::Iterator iterator; - !iterator.isDone(); - iterator.next()) { - if (use_arrays) - glDrawArrays(GL_QUADS, 0, count); - else - renderGLGeometryImmediate(count, vertices, texture, color, dim, stride); - } - } else { - if (use_arrays) - glDrawArrays(GL_QUADS, 0, count); - else - renderGLGeometryImmediate(count, vertices, texture, color, dim, stride); - } - - if (use_arrays) { - 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) -#else - // Find out correct glVertex*fv function according to dim parameter. - void (*glVertexFunc)(const float*) = glVertex2fv; - if (dim == 3) - glVertexFunc = glVertex3fv; - else if (dim == 4) - glVertexFunc = glVertex4fv; - - // These are number of _floats_ per item, not _bytes_ per item as opengl uses. - int vsize, tsize, csize; - vsize = tsize = csize = stride / sizeof(float); - if (!stride) { - // 0 means that arrays are tightly packed. This gives us different - // strides for different arrays - vsize = dim; - tsize = 2; - csize = 4; - } - - glBegin(GL_QUADS); - // This sucks. But makes it faster. - if (texture && color) { - for (int i = 0; i < count; i++) { - glTexCoord2fv(texture + i * tsize); - glColor4fv(color + i * csize); - glVertexFunc(vertices + i * vsize); - } - } else if (texture) { - for (int i = 0; i < count; i++) { - glTexCoord2fv(texture + i * tsize); - glVertexFunc(vertices + i * vsize); - } - } else if (color) { - for (int i = 0; i < count; i++) { - glColor4fv(color + i * csize); - glVertexFunc(vertices + i * vsize); - } - } else { - for (int i = 0; i < count; i++) - glVertexFunc(vertices + i * vsize); - } - glEnd(); -#endif -} - void addQuadVertices(QVector& verts, float x1, float y1, float x2, float y2) { verts << x1 << y1; diff --git a/lib/kwinglutils.h b/lib/kwinglutils.h index 468d7b4bb5..829d5fe580 100644 --- a/lib/kwinglutils.h +++ b/lib/kwinglutils.h @@ -85,44 +85,6 @@ inline bool KWIN_EXPORT isPowerOfTwo(int x) **/ int KWIN_EXPORT nearestPowerOfTwo(int x); -/** - * Renders quads using given vertices. - * If texture is not 0, each texture coordinate much have two components (st). - * If color is not 0, each color much have four components (rgba). - * Note that texture coordinates must match texture type (normalized/unnormalized - * for GL_TEXTURE_2D/GL_TEXTURE_ARB). - * - * In OpenGL ES this method is a no-op. - * - * @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 - * arrays must be tighly packed. Stride must be a multiple of sizeof(float)! - * @deprecated Use GLVertexBuffer - * @see GLVertexBuffer - **/ -KWIN_EXPORT void renderGLGeometry(const QRegion& region, int count, - const float* vertices, const float* texture = 0, const float* color = 0, - int dim = 2, int stride = 0); -/** - * Same as above, renders without specified region - * @deprecated Use GLVertexBuffer - * @see GLVertexBuffer - **/ -KWIN_EXPORT void renderGLGeometry(int count, - const float* vertices, const float* texture = 0, const float* color = 0, - int dim = 2, int stride = 0); - -/** - * In OpenGL ES this method is a no-op. - * - * @deprecated Use GLVertexBuffer - * @see GLVertexBuffer - **/ -KWIN_EXPORT void renderGLGeometryImmediate(int count, - const float* vertices, const float* texture = 0, const float* color = 0, - int dim = 2, int stride = 0); - /** * @deprecated Quads are not available in OpenGL ES **/