compiz team mailing list archive
-
compiz team
-
Mailing list archive
-
Message #31959
[Merge] lp:~sil2100/compcomm-plugins-main/missing_version into lp:~compiz/compcomm-plugins-main/ubuntu
Łukasz Zemczak has proposed merging lp:~sil2100/compcomm-plugins-main/missing_version into lp:~compiz/compcomm-plugins-main/ubuntu.
Requested reviews:
compiz packagers (compiz)
For more details, see:
https://code.launchpad.net/~sil2100/compcomm-plugins-main/missing_version/+merge/101387
Adding the missing 1:0.9.7.0~bzr19-0ubuntu9 from the precise PPA, introducing those armel/armhf linaro fixes. No big changes here, so it should build and work correctly for ARM as well. Seems to build on non-arm systems normally too.
--
https://code.launchpad.net/~sil2100/compcomm-plugins-main/missing_version/+merge/101387
Your team compiz packagers is requested to review the proposed merge of lp:~sil2100/compcomm-plugins-main/missing_version into lp:~compiz/compcomm-plugins-main/ubuntu.
=== modified file 'debian/changelog'
--- debian/changelog 2012-04-10 08:32:19 +0000
+++ debian/changelog 2012-04-10 14:55:08 +0000
@@ -16,6 +16,20 @@
-- Sam Spilsbury <sam.spilsbury@xxxxxxxxxxxxx> Fri, 06 Apr 2012 13:40:07 +0800
+compiz-plugins-main (1:0.9.7.0~bzr19-0ubuntu9) precise; urgency=low
+
+ * add quilt support to debian/rules
+ * enable per-arch patches in debian/rules (series.<arch> is now respected)
+ * add arch specific .install files for armel/armhf
+ * enable gles2 buildoptions on armel/armhf
+ * add arch specific compiz-plugins-main-gles2.patch for arm arches, credits
+ go to Alexandros Frantzis <alexandros.frantzis@xxxxxxxxxx> for creating
+ it.
+ * build depend on compiz-dev 1:0.9.7.4-0ubuntu3 since we need the
+ FindOpenGLES2.cmake fix from this version to build on armhf(/el)
+
+ -- Oliver Grawert <ogra@xxxxxxxxxx> Fri, 06 Apr 2012 02:50:50 +0200
+
compiz-plugins-main (1:0.9.7.0~bzr19-0ubuntu8) precise; urgency=low
[ Matthias Niess]
=== added symlink 'debian/compiz-plugins-main.install.armel'
=== target is u'compiz-plugins-main.install.armhf'
=== added file 'debian/compiz-plugins-main.install.armhf'
--- debian/compiz-plugins-main.install.armhf 1970-01-01 00:00:00 +0000
+++ debian/compiz-plugins-main.install.armhf 2012-04-10 14:55:08 +0000
@@ -0,0 +1,24 @@
+debian/tmp/usr/*/compiz/*imgjpeg.*
+debian/tmp/usr/share/gconf/schemas/*imgjpeg.*
+debian/tmp/usr/*/compiz/*kdecompat.*
+debian/tmp/usr/share/gconf/schemas/*kdecompat.*
+debian/tmp/usr/*/compiz/*neg.*
+debian/tmp/usr/share/gconf/schemas/*neg.*
+debian/tmp/usr/*/compiz/*opacify.*
+debian/tmp/usr/share/gconf/schemas/*opacify.*
+debian/tmp/usr/*/compiz/*put.*
+debian/tmp/usr/share/gconf/schemas/*put.*
+debian/tmp/usr/*/compiz/*resizeinfo.*
+debian/tmp/usr/share/gconf/schemas/*resizeinfo.*
+debian/tmp/usr/*/compiz/*ring.*
+debian/tmp/usr/share/gconf/schemas/*ring.*
+debian/tmp/usr/*/compiz/*scaleaddon.*
+debian/tmp/usr/share/gconf/schemas/*scaleaddon.*
+debian/tmp/usr/*/compiz/*shift.*
+debian/tmp/usr/share/gconf/schemas/*shift.*
+debian/tmp/usr/*/compiz/*text.*
+debian/tmp/usr/share/gconf/schemas/*text.*
+debian/tmp/usr/*/compiz/*thumbnail.*
+debian/tmp/usr/share/gconf/schemas/*thumbnail.*
+debian/tmp/usr/*/compiz/*winrules.*
+debian/tmp/usr/share/gconf/schemas/*winrules.*
=== modified file 'debian/control'
--- debian/control 2012-03-20 13:50:04 +0000
+++ debian/control 2012-04-10 14:55:08 +0000
@@ -7,11 +7,11 @@
cmake,
quilt,
intltool,
- compiz-dev (>= 1:0.9.7.2),
+ compiz-dev (>= 1:0.9.7.4-0ubuntu3),
libgconf2-dev,
libglib2.0-dev,
libtool,
- libglu1-mesa-dev,
+ libglu1-mesa-dev [!armel !armhf],
libjpeg-dev,
libxml2-dev,
libxslt1-dev,
=== added file 'debian/patches/compiz-plugins-main-gles2.patch'
--- debian/patches/compiz-plugins-main-gles2.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/compiz-plugins-main-gles2.patch 2012-04-10 14:55:08 +0000
@@ -0,0 +1,5173 @@
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/animation/animation.xml.in compiz-plugins-main-gles2/animation/animation.xml.in
+--- compiz-plugins-main-package/animation/animation.xml.in 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/animation/animation.xml.in 2012-04-05 12:29:41.374453000 +0200
+@@ -124,7 +124,7 @@
+ <type>match</type>
+ <default>
+ <value>((type=Normal | Unknown) | name=sun-awt-X11-XFramePeer | name=sun-awt-X11-XDialogPeer) & !(role=toolTipTip | role=qtooltip_label) & !(type=Normal & override_redirect=1) & !(name=gnome-screensaver) & !(name=gnome-screenshot)</value>
+- <value>(type=Menu | PopupMenu | DropdownMenu | Combo | Dialog | ModalDialog | Normal)</value>
++ <value>(type=Menu | PopupMenu | DropdownMenu | Combo | Dialog | ModalDialog | Normal)</value>
+ <value>(type=Tooltip | Notification | Utility) & !(name=compiz) & !(title=notify-osd)</value>
+ </default>
+ </option>
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/animation/CMakeLists.txt compiz-plugins-main-gles2/animation/CMakeLists.txt
+--- compiz-plugins-main-package/animation/CMakeLists.txt 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/animation/CMakeLists.txt 2012-04-05 12:29:41.374453000 +0200
+@@ -1,7 +1,5 @@
+ find_package (Compiz REQUIRED)
+ include (CompizPlugin)
+-include (FindOpenGL)
+
+-if (OPENGL_GLU_FOUND)
+- compiz_plugin (animation PLUGINDEPS composite opengl LIBRARIES ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR})
+-endif (OPENGL_GLU_FOUND)
++compiz_plugin (animation PLUGINDEPS composite opengl)
++
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/animation/include/animation/animation.h compiz-plugins-main-gles2/animation/include/animation/animation.h
+--- compiz-plugins-main-package/animation/include/animation/animation.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/animation/include/animation/animation.h 2012-04-05 12:29:41.374453000 +0200
+@@ -3,8 +3,8 @@
+
+ #define ANIMATION_ABI 20091205
+
++#include <core/core.h>
+ #include <core/pluginclasshandler.h>
+-#include <opengl/fragment.h>
+
+ typedef enum
+ {
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/animation/include/animation/animeffect.h compiz-plugins-main-gles2/animation/include/animation/animeffect.h
+--- compiz-plugins-main-package/animation/include/animation/animeffect.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/animation/include/animation/animeffect.h 2012-04-05 12:29:41.374453000 +0200
+@@ -72,7 +72,7 @@
+
+ int mOverrideProgressDir; ///< 0: default dir, 1: forward, 2: backward
+
+- GLFragment::Attrib mCurPaintAttrib;
++ GLWindowPaintAttrib mCurPaintAttrib;
+ GLushort mStoredOpacity;
+ WindowEvent mCurWindowEvent;
+ bool mInitialized; ///< whether the animation is initialized (in preparePaint)
+@@ -160,7 +160,6 @@
+ const CompRegion &clip,
+ unsigned int maxGridWidth,
+ unsigned int maxGridHeight);
+- virtual void drawGeometry ();
+
+ virtual bool paintWindowUsed () { return false; }
+ virtual bool paintWindow (GLWindow *gWindow,
+@@ -176,9 +175,10 @@
+ /// Should be overriden by a base animation class in every extension plugin.
+ virtual ExtensionPluginInfo *getExtensionPluginInfo ();
+
+- void drawTexture (GLTexture *texture,
+- GLFragment::Attrib &attrib,
+- unsigned int mask);
++ void drawTexture (GLTexture *texture,
++ const GLMatrix &transform,
++ const GLWindowPaintAttrib &attrib,
++ unsigned int mask);
+
+ // Utility methods
+
+@@ -203,7 +203,7 @@
+ GLMatrix &transform);
+ void setInitialized () { mInitialized = true; }
+ inline bool initialized () { return mInitialized; }
+- inline void setCurPaintAttrib (GLFragment::Attrib &newAttrib)
++ inline void setCurPaintAttrib (const GLWindowPaintAttrib &newAttrib)
+ { mCurPaintAttrib = newAttrib; }
+ };
+ #endif
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/animation/include/animation/grid.h compiz-plugins-main-gles2/animation/include/animation/grid.h
+--- compiz-plugins-main-package/animation/include/animation/grid.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/animation/include/animation/grid.h 2012-04-05 12:29:41.374453000 +0200
+@@ -78,8 +78,6 @@
+ /// ( http://www.r3.nu/~cass/qcoord/ )
+ bool mUseQTexCoord;
+
+- GLWindow::Geometry mGeometry; ///< geometry for grid mesh
+-
+ virtual bool using3D () { return false; }
+
+ virtual void initGrid (); ///< Initializes grid width/height.
+@@ -101,6 +99,5 @@
+ const CompRegion &clip,
+ unsigned int maxGridWidth,
+ unsigned int maxGridHeight);
+- void drawGeometry ();
+ };
+ #endif
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/animation/include/animation/multi.h compiz-plugins-main-gles2/animation/include/animation/multi.h
+--- compiz-plugins-main-package/animation/include/animation/multi.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/animation/include/animation/multi.h 2012-04-05 12:29:41.374453000 +0200
+@@ -340,12 +340,6 @@
+ (matrix, region, clip, maxGridWidth, maxGridHeight);
+ }
+
+- void drawGeometry ()
+- {
+- setCurrAnimNumber (mAWindow, currentAnim);
+- animList.at (currentAnim)->drawGeometry ();
+- }
+-
+ bool paintWindowUsed ()
+ {
+ int count = 0;
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/animation/src/animation.cpp compiz-plugins-main-gles2/animation/src/animation.cpp
+--- compiz-plugins-main-package/animation/src/animation.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/animation/src/animation.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -26,6 +26,10 @@
+ * Particle system added by : (C) 2006 Dennis Kasprzyk
+ * E-mail : onestone@xxxxxxxxxxxxxxxxx
+ *
++ * Ported to GLES by : Travis Watkins
++ * (C) 2011 Linaro Limited
++ * E-mail : travis.watkins@xxxxxxxxxx
++ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+@@ -80,8 +84,9 @@
+ *
+ */
+
+-#include <GL/glu.h>
+ #include <core/atoms.h>
++#include <core/core.h>
++#include <opengl/opengl.h>
+ #include <sys/time.h>
+ #include <assert.h>
+ #include "private.h"
+@@ -802,6 +807,58 @@
+ coordsTransformed[GLVector::y]);
+ }
+
++static bool
++project (float objx, float objy, float objz,
++ GLMatrix modelview, GLMatrix projection,
++ const GLint viewport[4],
++ float *winx, float *winy, float *winz)
++{
++ unsigned int i;
++ float in[4];
++ float out[4];
++
++ in[0] = objx;
++ in[1] = objy;
++ in[2] = objz;
++ in[3] = 1.0;
++
++ for (i = 0; i < 4; i++) {
++ out[i] =
++ in[0] * modelview[i] +
++ in[1] * modelview[4 + i] +
++ in[2] * modelview[8 + i] +
++ in[3] * modelview[12 + i];
++ }
++
++ for (i = 0; i < 4; i++) {
++ in[i] =
++ out[0] * projection[i] +
++ out[1] * projection[4 + i] +
++ out[2] * projection[8 + i] +
++ out[3] * projection[12 + i];
++ }
++
++ if (in[3] == 0.0)
++ return false;
++
++ in[0] /= in[3];
++ in[1] /= in[3];
++ in[2] /= in[3];
++ /* Map x, y and z to range 0-1 */
++ in[0] = in[0] * 0.5 + 0.5;
++ in[1] = in[1] * 0.5 + 0.5;
++ in[2] = in[2] * 0.5 + 0.5;
++
++ /* Map x,y to viewport */
++ in[0] = in[0] * viewport[2] + viewport[0];
++ in[1] = in[1] * viewport[3] + viewport[1];
++
++ *winx = in[0];
++ *winy = in[1];
++ *winz = in[2];
++ return true;
++}
++
+ /// Either points or objects should be non-0.
+ bool
+ AnimWindow::expandBBWithPoints3DTransform (CompOutput &output,
+@@ -810,14 +867,7 @@
+ GridAnim::GridModel::GridObject *objects,
+ unsigned int nPoints)
+ {
+- GLdouble dModel[16];
+- GLdouble dProjection[16];
+- GLdouble x, y, z;
+- for (unsigned int i = 0; i < 16; i++)
+- {
+- dModel[i] = transform[i];
+- dProjection[i] = GLScreen::get (::screen)->projectionMatrix ()[i];
+- }
++ GLfloat x, y, z;
+ GLint viewport[4] =
+ {output.region ()->extents.x1,
+ output.region ()->extents.y1,
+@@ -828,9 +878,11 @@
+ {
+ for (; nPoints; nPoints--, points += 3)
+ {
+- if (!gluProject (points[0], points[1], points[2],
+- dModel, dProjection, viewport,
+- &x, &y, &z))
++ if (!project (points[0], points[1], points[2],
++ transform,
++ *GLScreen::get (::screen)->projectionMatrix (),
++ viewport,
++ &x, &y, &z))
+ return false;
+
+ expandBBWithPoint (x + 0.5, (::screen->height () - y) + 0.5);
+@@ -841,11 +893,13 @@
+ GridAnim::GridModel::GridObject *object = objects;
+ for (; nPoints; nPoints--, object++)
+ {
+- if (!gluProject (object->position ().x (),
+- object->position ().y (),
+- object->position ().z (),
+- dModel, dProjection, viewport,
+- &x, &y, &z))
++ if (!project (object->position ().x (),
++ object->position ().y (),
++ object->position ().z (),
++ transform,
++ *GLScreen::get (::screen)->projectionMatrix (),
++ viewport,
++ &x, &y, &z))
+ return false;
+
+ expandBBWithPoint (x + 0.5, (::screen->height () - y) + 0.5);
+@@ -1435,7 +1489,6 @@
+ {
+ gWindow->glPaintSetEnabled (this, enabling);
+ gWindow->glAddGeometrySetEnabled (this, enabling);
+- gWindow->glDrawGeometrySetEnabled (this, enabling);
+ gWindow->glDrawTextureSetEnabled (this, enabling);
+ }
+
+@@ -1508,46 +1561,28 @@
+ }
+
+ void
+-PrivateAnimWindow::glDrawTexture (GLTexture *texture,
+- GLFragment::Attrib &attrib,
+- unsigned int mask)
++PrivateAnimWindow::glDrawTexture (GLTexture *texture,
++ const GLMatrix &transform,
++ const GLWindowPaintAttrib &attrib,
++ unsigned int mask)
+ {
+ if (mCurAnimation)
+ {
+ mCurAnimation->setCurPaintAttrib (attrib);
+ }
+
+- gWindow->glDrawTexture (texture, attrib, mask);
++ gWindow->glDrawTexture (texture, transform, attrib, mask);
+ }
+
+ void
+-PrivateAnimWindow::glDrawGeometry ()
+-{
+- if (mCurAnimation)
+- {
+- if (mCurAnimation->initialized ())
+- mCurAnimation->drawGeometry ();
+- }
+- else
+- {
+- gWindow->glDrawGeometry ();
+- }
+-}
+-
+-void
+-Animation::drawTexture (GLTexture *texture,
+- GLFragment::Attrib &attrib,
+- unsigned int mask)
++Animation::drawTexture (GLTexture *texture,
++ const GLMatrix &transform,
++ const GLWindowPaintAttrib &attrib,
++ unsigned int mask)
+ {
+ mCurPaintAttrib = attrib;
+ }
+
+-void
+-Animation::drawGeometry ()
+-{
+- mAWindow->priv->gWindow->glDrawGeometry ();
+-}
+-
+ bool
+ PrivateAnimWindow::glPaint (const GLWindowPaintAttrib &attrib,
+ const GLMatrix &transform,
+@@ -1614,13 +1649,7 @@
+
+ if (mCurAnimation->postPaintWindowUsed ())
+ {
+- // Transform to make post-paint coincide with the window
+- glPushMatrix ();
+- glLoadMatrixf (wTransform.getMatrix ());
+-
+ mCurAnimation->postPaintWindow ();
+-
+- glPopMatrix ();
+ }
+
+ return status;
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/animation/src/grid.cpp compiz-plugins-main-gles2/animation/src/grid.cpp
+--- compiz-plugins-main-package/animation/src/grid.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/animation/src/grid.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -19,6 +19,10 @@
+ * Hexagon tessellator added by : Mike Slegeir
+ * E-mail : mikeslegeir@xxxxxxxxxxxxxxx>
+ *
++ * Ported to GLES by : Travis Watkins
++ * (C) 2011 Linaro Limited
++ * E-mail : travis.watkins@xxxxxxxxxx
++ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+@@ -36,6 +40,17 @@
+
+ #include "private.h"
+
++// use the old structure then copy the data we want out of it
++struct GridGeometry {
++ GLfloat *vertices;
++ int vertexSize;
++ int vertexStride;
++ int vCount;
++ int texUnits;
++ int texCoordSize;
++};
++
++
+ // ===================== Effect: Dodge =========================
+
+ GridAnim::GridModel::GridObject::GridObject () :
+@@ -217,9 +232,9 @@
+ unsigned int maxGridWidth,
+ unsigned int maxGridHeight)
+ {
++ GridGeometry geometry;
+ unsigned int nMatrix = matrix.size ();
+- int nVertices, nIndices;
+- GLushort *i;
++ int nVertices;
+ GLfloat *v;
+ int x1, y1, x2, y2;
+ float winContentsY, winContentsHeight;
+@@ -234,8 +249,6 @@
+ if (region.isEmpty ()) // nothing to do
+ return;
+
+- GLWindow::Geometry &geometry = GLWindow::get (mWindow)->geometry ();
+-
+ for (unsigned int it = 0; it < nMatrix; it++)
+ {
+ if (matrix[it].xy != 0.0f || matrix[it].yx != 0.0f)
+@@ -263,21 +276,14 @@
+ winContentsHeight = oheight - outExtents.top - outExtents.bottom;
+
+ geometry.texUnits = (int)nMatrix;
+-
+- if (geometry.vCount == 0)
+- {
+- // reset
+- geometry.indexCount = 0;
+- geometry.texCoordSize = 4;
+- }
++ geometry.vertices = NULL;
++ geometry.vCount = 0;
++ geometry.texCoordSize = 4;
+ geometry.vertexStride = 3 + geometry.texUnits * geometry.texCoordSize;
+- vSize = geometry.vertexStride;
+
++ vSize = geometry.vertexStride;
+ nVertices = geometry.vCount;
+- nIndices = geometry.indexCount;
+-
+ v = geometry.vertices + (nVertices * vSize);
+- i = geometry.indices + nIndices;
+
+ // For each clip passed to this function
+ foreach (const CompRect &pClip, region.rects ())
+@@ -315,38 +321,22 @@
+ nVertX = ceil ((x2 - x1) / gridW) + 2;
+ nVertY = (gridH ? ceil ((y2 - y1) / gridH) : 0) + 2;
+
+- // Allocate 4 indices for each quad
+- int newIndexSize = nIndices + ((nVertX - 1) * (nVertY - 1) * 4);
+-
+- if (newIndexSize > geometry.indexSize)
+- {
+- if (!geometry.moreIndices (newIndexSize))
+- return;
+-
+- i = geometry.indices + nIndices;
+- }
+- // Assign quad vertices to indices
+- for (int jy = 0; jy < nVertY - 1; jy++)
+- {
+- for (int jx = 0; jx < nVertX - 1; jx++)
+- {
+- *i++ = nVertices + nVertX * (2 * jy + 1) + jx;
+- *i++ = nVertices + nVertX * (2 * jy + 1) + jx + 1;
+- *i++ = nVertices + nVertX * 2 * jy + jx + 1;
+- *i++ = nVertices + nVertX * 2 * jy + jx;
+-
+- nIndices += 4;
+- }
+- }
+-
+ // Allocate vertices
+ int newVertexSize =
+ (nVertices + nVertX * (2 * nVertY - 2)) * vSize;
+- if (newVertexSize > geometry.vertexSize)
++ if (newVertexSize > geometry.vertexSize || geometry.vertices == NULL)
+ {
+- if (!geometry.moreVertices (newVertexSize))
++ if (geometry.vertices == NULL)
++ geometry.vertices = (GLfloat *)
++ malloc (sizeof (GLfloat) * newVertexSize);
++ else
++ geometry.vertices = (GLfloat *)
++ realloc (geometry.vertices, sizeof (GLfloat) * newVertexSize);
++
++ if (!geometry.vertices)
+ return;
+
++ geometry.vertexSize = newVertexSize;
+ v = geometry.vertices + (nVertices * vSize);
+ }
+
+@@ -588,52 +578,8 @@
+ }
+ }
+ }
+- geometry.vCount = nVertices;
+- geometry.indexCount = nIndices;
+-}
+-
+-void
+-GridAnim::drawGeometry ()
+-{
+- GLWindow::Geometry &geometry = GLWindow::get (mWindow)->geometry ();
+
+- int texUnit = geometry.texUnits;
+- int currentTexUnit = 0;
+- int stride = geometry.vertexStride;
+- GLfloat *vertices = geometry.vertices + (stride - 3);
+-
+- stride *= (int) sizeof (GLfloat);
+-
+- glVertexPointer (3, GL_FLOAT, stride, vertices);
+-
+- while (texUnit--)
+- {
+- if (texUnit != currentTexUnit)
+- {
+- (*GL::clientActiveTexture) ((GLenum)(GL_TEXTURE0_ARB + texUnit));
+- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
+- currentTexUnit = texUnit;
+- }
+- vertices -= geometry.texCoordSize;
+- glTexCoordPointer (geometry.texCoordSize,
+- GL_FLOAT, stride, vertices);
+- }
+-
+- glDrawElements (GL_QUADS, geometry.indexCount,
+- GL_UNSIGNED_SHORT, geometry.indices);
+-
+- // disable all texture coordinate arrays except 0
+- texUnit = geometry.texUnits;
+- if (texUnit > 1)
+- {
+- while (--texUnit)
+- {
+- (*GL::clientActiveTexture) ((GLenum)(GL_TEXTURE0_ARB + texUnit));
+- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
+- }
+-
+- (*GL::clientActiveTexture) (GL_TEXTURE0_ARB);
+- }
++ geometry.vCount = nVertices;
+ }
+
+ GridTransformAnim::GridTransformAnim (CompWindow *w,
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/animation/src/private.h compiz-plugins-main-gles2/animation/src/private.h
+--- compiz-plugins-main-package/animation/src/private.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/animation/src/private.h 2012-04-05 12:29:41.374453000 +0200
+@@ -407,9 +407,8 @@
+ void glAddGeometry (const GLTexture::MatrixList &,
+ const CompRegion &, const CompRegion &,
+ unsigned int = MAXSHORT, unsigned int = MAXSHORT);
+- void glDrawTexture (GLTexture *texture, GLFragment::Attrib &,
+- unsigned int);
+- void glDrawGeometry ();
++ void glDrawTexture (GLTexture *texture, const GLMatrix &,
++ const GLWindowPaintAttrib &, unsigned int);
+ };
+
+ class RollUpAnim :
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/colorfilter/CMakeLists.txt compiz-plugins-main-gles2/colorfilter/CMakeLists.txt
+--- compiz-plugins-main-package/colorfilter/CMakeLists.txt 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/colorfilter/CMakeLists.txt 2012-04-05 12:29:41.374453000 +0200
+@@ -2,4 +2,4 @@
+
+ include (CompizPlugin)
+
+-compiz_plugin (colorfilter PLUGINDEPS composite opengl)
++#compiz_plugin (colorfilter PLUGINDEPS composite opengl)
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/expo/CMakeLists.txt compiz-plugins-main-gles2/expo/CMakeLists.txt
+--- compiz-plugins-main-package/expo/CMakeLists.txt 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/expo/CMakeLists.txt 2012-04-05 12:29:41.374453000 +0200
+@@ -1,7 +1,4 @@
+ find_package (Compiz REQUIRED)
+-include (FindOpenGL)
+ include (CompizPlugin)
+
+-if (OPENGL_GLU_FOUND)
+- compiz_plugin (expo PLUGINDEPS composite opengl PKGDEPS cairo cairo-xlib-xrender LIBRARIES ${OPENGL_glu_LIBRARY} INCDIRS ${OPENGL_INCLUDE_DIR})
+-endif (OPENGL_GLU_FOUND)
++compiz_plugin (expo PLUGINDEPS composite opengl)
+Binary files compiz-plugins-main-package/expo/images/glow_outline.png and compiz-plugins-main-gles2/expo/images/glow_outline.png differ
+Binary files compiz-plugins-main-package/expo/images/texture_tile.png and compiz-plugins-main-gles2/expo/images/texture_tile.png differ
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/expo/src/expo.cpp compiz-plugins-main-gles2/expo/src/expo.cpp
+--- compiz-plugins-main-package/expo/src/expo.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/expo/src/expo.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -4,12 +4,14 @@
+ *
+ * expo.c
+ *
++ * Copyright (c) 2011 Linaro Limited
+ * Copyright (c) 2008 Dennis Kasprzyk <racarr@xxxxxxxxxxxxxxxxxxx>
+ * Copyright (c) 2006 Robert Carr <racarr@xxxxxxxxxxxxxxxxx>
+ *
+ * Authors:
+ * Robert Carr <racarr@xxxxxxxxxxxxxxxxx>
+ * Dennis Kasprzyk <onestone@xxxxxxxxxxxxxxxxxxx>
++ * Travis Watkins <travis.watkins@xxxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+@@ -25,7 +27,7 @@
+
+ #include "expo.h"
+ #include <math.h>
+-#include <GL/glu.h>
++#include <opengl/opengl.h>
+ #include <X11/cursorfont.h>
+
+ COMPIZ_PLUGIN_20090315 (expo, ExpoPluginVTable);
+@@ -658,15 +660,63 @@
+ }
+ }
+
++static bool
++unproject (float winx, float winy, float winz,
++ const GLMatrix &modelview,
++ const GLMatrix &projection,
++ const GLint viewport[4],
++ float *objx, float *objy, float *objz)
++{
++ GLMatrix finalMatrix = projection * modelview;
++ float in[4], out[4];
++
++ if (!finalMatrix.invert ())
++ return false;
++
++ in[0] = winx;
++ in[1] = winy;
++ in[2] = winz;
++ in[3] = 1.0;
++
++ /* Map x and y from window coordinates */
++ in[0] = (in[0] - viewport[0]) / viewport[2];
++ in[1] = (in[1] - viewport[1]) / viewport[3];
++
++ /* Map to range -1 to 1 */
++ in[0] = in[0] * 2 - 1;
++ in[1] = in[1] * 2 - 1;
++ in[2] = in[2] * 2 - 1;
++
++ for (int i = 0; i < 4; i++)
++ {
++ out[i] = in[0] * finalMatrix[i] +
++ in[1] * finalMatrix[4 + i] +
++ in[2] * finalMatrix[8 + i] +
++ in[3] * finalMatrix[12 + i];
++ }
++
++ if (out[3] == 0.0)
++ return false;
++
++ out[0] /= out[3];
++ out[1] /= out[3];
++ out[2] /= out[3];
++
++ *objx = out[0];
++ *objy = out[1];
++ *objz = out[2];
++
++ return true;
++}
++
+ void
+-ExpoScreen::invertTransformedVertex (const GLScreenPaintAttrib& attrib,
+- const GLMatrix& transform,
+- CompOutput *output,
+- int vertex[2])
++ExpoScreen::invertTransformedVertex (const GLScreenPaintAttrib &attrib,
++ const GLMatrix &transform,
++ CompOutput *output,
++ int vertex[2])
+ {
+ GLMatrix sTransform (transform);
+- GLdouble p1[3], p2[3], v[3], alpha;
+- GLdouble mvm[16], pm[16];
++ float p1[3], p2[3], v[3], alpha;
+ GLint viewport[4];
+ int i;
+
+@@ -674,16 +724,13 @@
+ sTransform.toScreenSpace (output, -attrib.zTranslate);
+
+ glGetIntegerv (GL_VIEWPORT, viewport);
+- for (i = 0; i < 16; i++)
+- {
+- mvm[i] = sTransform[i];
+- pm[i] = gScreen->projectionMatrix ()[i];
+- }
+
+- gluUnProject (vertex[0], screen->height () - vertex[1], 0, mvm, pm,
+- viewport, &p1[0], &p1[1], &p1[2]);
+- gluUnProject (vertex[0], screen->height () - vertex[1], -1.0, mvm, pm,
+- viewport, &p2[0], &p2[1], &p2[2]);
++ unproject (vertex[0], screen->height () - vertex[1], 0,
++ sTransform, *gScreen->projectionMatrix (), viewport,
++ &p1[0], &p1[1], &p1[2]);
++ unproject (vertex[0], screen->height () - vertex[1], -1.0,
++ sTransform, *gScreen->projectionMatrix (), viewport,
++ &p2[0], &p2[1], &p2[2]);
+
+ for (i = 0; i < 3; i++)
+ v[i] = p1[i] - p2[i];
+@@ -855,6 +902,8 @@
+ unsigned int mask,
+ bool reflection)
+ {
++ GLfloat vertexData[12];
++ GLushort colorData[16];
+ GLMatrix sTransformW, sTransform (transform);
+ GLenum oldFilter = gScreen->textureFilter ();
+ float sx = (float) screen->width () / output->width ();
+@@ -873,6 +922,8 @@
+ int glPaintTransformedOutputIndex =
+ gScreen->glPaintTransformedOutputGetCurrentIndex ();
+
++ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
++
+ // Make sure that the base glPaintTransformedOutput function is called
+ gScreen->glPaintTransformedOutputSetCurrentIndex (MAXSHORT);
+
+@@ -965,7 +1016,7 @@
+ /* zoom out */
+ oScale = DEFAULT_Z_CAMERA / (cam[GLVector::z] + DEFAULT_Z_CAMERA);
+ sTransform.scale (oScale, oScale, oScale);
+- glNormal3f (0.0, 0.0, -oScale);
++// glNormal3f (0.0, 0.0, -oScale);
+ sTransform.translate (-cam[GLVector::x], -cam[GLVector::y],
+ -cam[GLVector::z] - DEFAULT_Z_CAMERA);
+
+@@ -1058,73 +1109,167 @@
+
+ paintingDndWindow = false;
+
+- glNormal3f (0.0, 0.0, -1.0);
++// glNormal3f (0.0, 0.0, -1.0);
+
+ if (reflection)
+ {
+- glEnable (GL_BLEND);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+- glPushMatrix ();
+-
+ if (optionGetDeform () != DeformCurve)
+ {
+- glLoadMatrixf (sTransformW.getMatrix ());
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ colorData[0] = 0;
++ colorData[1] = 0;
++ colorData[2] = 0;
++ colorData[3] = 65535;
++ colorData[4] = 0;
++ colorData[5] = 0;
++ colorData[6] = 0;
++ colorData[7] = 32768;
++ colorData[8] = 0;
++ colorData[9] = 0;
++ colorData[10] = 0;
++ colorData[11] = 65535;
++ colorData[12] = 0;
++ colorData[13] = 0;
++ colorData[14] = 0;
++ colorData[15] = 32768;
++
++ vertexData[0] = 0;
++ vertexData[1] = 0;
++ vertexData[2] = 0;
++ vertexData[3] = 0;
++ vertexData[4] = -vpSize.y () * (sy + gapY);
++ vertexData[5] = 0;
++ vertexData[6] = vpSize.x () * sx * (1.0 + gapX);
++ vertexData[7] = 0;
++ vertexData[8] = 0;
++ vertexData[9] = vpSize.x () * sx * (1.0 + gapX);
++ vertexData[10] = -vpSize.y () * sy * (1.0 + gapY);
++ vertexData[11] = 0;
++
++ streamingBuffer->addColors (4, colorData);
++ streamingBuffer->addVertices (4, vertexData);
+
+- glBegin (GL_QUADS);
+- glColor4f (0.0, 0.0, 0.0, 1.0);
+- glVertex2f (0.0, 0.0);
+- glColor4f (0.0, 0.0, 0.0, 0.5);
+- glVertex2f (0.0, -vpSize.y () * (sy + gapY));
+- glVertex2f (vpSize.x () * sx * (1.0 + gapX),
+- -vpSize.y () * sy * (1.0 + gapY));
+- glColor4f (0.0, 0.0, 0.0, 1.0);
+- glVertex2f (vpSize.x () * sx * (1.0 + gapX), 0.0);
+- glEnd ();
++ streamingBuffer->end ();
++ streamingBuffer->render (sTransformW);
+ }
+ else
+ {
++ GLMatrix cTransform;
++ cTransform.translate (0.0, 0.0, -DEFAULT_Z_CAMERA);
++
+ glCullFace (GL_BACK);
+- glLoadIdentity ();
+- glTranslatef (0.0, 0.0, -DEFAULT_Z_CAMERA);
+
+- glBegin (GL_QUADS);
+- glColor4f (0.0, 0.0, 0.0, 1.0 * expoCam);
+- glVertex2f (-0.5, -0.5);
+- glVertex2f (0.5, -0.5);
+- glColor4f (0.0, 0.0, 0.0, 0.5 * expoCam);
+- glVertex2f (0.5, 0.0);
+- glVertex2f (-0.5, 0.0);
+- glColor4f (0.0, 0.0, 0.0, 0.5 * expoCam);
+- glVertex2f (-0.5, 0.0);
+- glVertex2f (0.5, 0.0);
+- glColor4f (0.0, 0.0, 0.0, 0.0);
+- glVertex2f (0.5, 0.5);
+- glVertex2f (-0.5, 0.5);
+- glEnd ();
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ colorData[0] = 0;
++ colorData[1] = 0;
++ colorData[2] = 0;
++ colorData[3] = (1.0 * expoCam) * 65536;
++ colorData[4] = 0;
++ colorData[5] = 0;
++ colorData[6] = 0;
++ colorData[7] = (1.0 * expoCam) * 65536;
++ colorData[8] = 0;
++ colorData[9] = 0;
++ colorData[10] = 0;
++ colorData[11] = (0.5 * expoCam) * 65536;
++ colorData[12] = 0;
++ colorData[13] = 0;
++ colorData[14] = 0;
++ colorData[15] = (0.5 * expoCam) * 65536;
++
++ vertexData[0] = -0.5;
++ vertexData[1] = -0.5;
++ vertexData[2] = 0;
++ vertexData[3] = 0.5;
++ vertexData[4] = -0.5;
++ vertexData[5] = 0;
++ vertexData[6] = -0.5;
++ vertexData[7] = 0;
++ vertexData[8] = 0;
++ vertexData[9] = 0.5;
++ vertexData[10] = 0;
++ vertexData[11] = 0;
++
++ streamingBuffer->addColors (4, colorData);
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (cTransform);
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ colorData[0] = 0;
++ colorData[1] = 0;
++ colorData[2] = 0;
++ colorData[3] = (0.5 * expoCam) * 65536;
++ colorData[4] = 0;
++ colorData[5] = 0;
++ colorData[6] = 0;
++ colorData[7] = (0.5 * expoCam) * 65536;
++ colorData[8] = 0;
++ colorData[9] = 0;
++ colorData[10] = 0;
++ colorData[11] = 0;
++ colorData[12] = 0;
++ colorData[13] = 0;
++ colorData[14] = 0;
++ colorData[15] = 0;
++
++ vertexData[0] = -0.5;
++ vertexData[1] = 0;
++ vertexData[2] = 0;
++ vertexData[3] = 0.5;
++ vertexData[4] = 0;
++ vertexData[5] = 0;
++ vertexData[6] = -0.5;
++ vertexData[7] = 0.5;
++ vertexData[8] = 0;
++ vertexData[9] = 0.5;
++ vertexData[10] = 0.5;
++ vertexData[11] = 0;
++
++ streamingBuffer->addColors (4, colorData);
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (cTransform);
+ }
+ glCullFace (GL_BACK);
+
+- glLoadIdentity ();
+- glTranslatef (0.0, 0.0, -DEFAULT_Z_CAMERA);
+-
+ if (optionGetGroundSize () > 0.0)
+ {
+- glBegin (GL_QUADS);
+- glColor4usv (optionGetGroundColor1 ());
+- glVertex2f (-0.5, -0.5);
+- glVertex2f (0.5, -0.5);
+- glColor4usv (optionGetGroundColor2 ());
+- glVertex2f (0.5, -0.5 + optionGetGroundSize ());
+- glVertex2f (-0.5, -0.5 + optionGetGroundSize ());
+- glEnd ();
+- }
++ GLMatrix gTransform;
++ gTransform.translate (0.0, 0.0, -DEFAULT_Z_CAMERA);
+
+- glColor4usv (defaultColor);
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
+
++ vertexData[0] = -0.5;
++ vertexData[1] = -0.5;
++ vertexData[2] = 0;
++ vertexData[3] = 0.5;
++ vertexData[4] = -0.5;
++ vertexData[5] = 0;
++ vertexData[6] = -0.5;
++ vertexData[7] = -0.5 + optionGetGroundSize ();
++ vertexData[8] = 0;
++ vertexData[9] = 0.5;
++ vertexData[10] = -0.5 + optionGetGroundSize ();
++ vertexData[11] = 0;
++
++ streamingBuffer->addColors (1, optionGetGroundColor1 ());
++ streamingBuffer->addColors (1, optionGetGroundColor1 ());
++ streamingBuffer->addColors (1, optionGetGroundColor2 ());
++ streamingBuffer->addColors (1, optionGetGroundColor2 ());
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (gTransform);
++ }
+ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+- glDisable (GL_BLEND);
+- glPopMatrix ();
+ }
+
+ expoActive = false;
+@@ -1188,10 +1333,10 @@
+ }
+
+ bool
+-ExpoWindow::glDraw (const GLMatrix& transform,
+- GLFragment::Attrib& fragment,
+- const CompRegion& region,
+- unsigned int mask)
++ExpoWindow::glDraw (const GLMatrix &transform,
++ const GLWindowPaintAttrib &attrib,
++ const CompRegion ®ion,
++ unsigned int mask)
+ {
+ GLMatrix wTransform (transform);
+ CompPoint vp;
+@@ -1199,17 +1344,17 @@
+ screen->viewportForGeometry (window->geometry (), vp);
+
+ if (eScreen->expoCam == 0.0f)
+- return gWindow->glDraw (transform, fragment, region, mask);
++ return gWindow->glDraw (transform, attrib, region, mask);
+
+- GLFragment::Attrib fA (fragment);
+- int expoAnimation;
++ GLWindowPaintAttrib eAttrib (attrib);
++ int expoAnimation;
+
+ expoAnimation = eScreen->optionGetExpoAnimation ();
+
+ if (eScreen->expoActive)
+ {
+ if (expoAnimation != ExpoScreen::ExpoAnimationZoom)
+- fA.setOpacity (fragment.getOpacity () * eScreen->expoCam);
++ eAttrib.opacity = attrib.opacity * eScreen->expoCam;
+
+ if (window->wmType () & CompWindowTypeDockMask &&
+ eScreen->optionGetHideDocks ())
+@@ -1217,31 +1362,31 @@
+ if (expoAnimation == ExpoScreen::ExpoAnimationZoom &&
+ eScreen->paintingVp == eScreen->selectedVp)
+ {
+- fA.setOpacity (fragment.getOpacity () *
+- (1 - sigmoidProgress (eScreen->expoCam)));
++ eAttrib.opacity = attrib.opacity *
++ (1 - sigmoidProgress (eScreen->expoCam));
+ }
+ else
+ {
+- fA.setOpacity (0);
++ eAttrib.opacity = 0;
+ }
+ }
+
+- if (vp == eScreen->paintingVp || window->onAllViewports ())
++ if ((vp == eScreen->paintingVp || window->onAllViewports ()) && !eScreen->paintingDndWindow)
+ {
+- fA.setBrightness (fragment.getBrightness () * eScreen->vpBrightness);
+- fA.setSaturation (fragment.getSaturation () * eScreen->vpSaturation);
++ eAttrib.brightness = attrib.brightness * eScreen->vpBrightness;
++ eAttrib.saturation = attrib.saturation * eScreen->vpSaturation;
+ }
+ }
+ else
+ {
+ if (expoAnimation == ExpoScreen::ExpoAnimationZoom)
+- fA.setBrightness (0);
++ eAttrib.brightness = 0;
+ else
+- fA.setBrightness (fragment.getBrightness () *
+- (1 - sigmoidProgress (eScreen->expoCam)));
++ eAttrib.brightness = attrib.brightness *
++ (1 - sigmoidProgress (eScreen->expoCam));
+ }
+
+- bool status = gWindow->glDraw (wTransform, fA, region, mask);
++ bool status = gWindow->glDraw (transform, eAttrib, region, mask);
+
+ if (window->type () & CompWindowTypeDesktopMask)
+ {
+@@ -1255,10 +1400,6 @@
+ GLTexture::Matrix mat = tex->matrix();
+ CompRegion paintRegion(region);
+
+- /* We can reset the window geometry since it will be
+- * re-added later */
+- gWindow->geometry().reset();
+-
+ float xScale = screen->width () / (float) eScreen->viewport_size.width ();
+ float yScale = screen->height () / (float) eScreen->viewport_size.height ();
+
+@@ -1278,27 +1419,26 @@
+ /* Now allow plugins to mess with the geometry of our
+ * dim (so we get a nice render for things like
+ * wobbly etc etc */
++ gWindow->vertexBuffer()->begin();
+ gWindow->glAddGeometry(matl, reg, paintRegion);
++ gWindow->vertexBuffer()->end();
+
+- /* Did it succeed? */
+- if (gWindow->geometry().vertices)
+- {
+- unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex();
+- fA.setOpacity (fragment.getOpacity () * (((1.0 - eScreen->vpBrightness) + (1.0 - eScreen->vpSaturation) / 2.0)));
+- /* Texture rendering set-up */
+- eScreen->gScreen->setTexEnvMode(GL_MODULATE);
+- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+- /* Draw the dim texture with all of it's modified
+- * geometry glory */
+- gWindow->glDrawTextureSetCurrentIndex(MAXSHORT);
+- gWindow->glDrawTexture(tex, fA, mask | PAINT_WINDOW_BLEND_MASK
+- | PAINT_WINDOW_TRANSLUCENT_MASK |
+- PAINT_WINDOW_TRANSFORMED_MASK);
+- gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex);
+- /* Texture rendering tear-down */
+- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+- eScreen->gScreen->setTexEnvMode(GL_REPLACE);
+- }
++ unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex();
++ eAttrib.opacity = attrib.opacity * (((1.0 - eScreen->vpBrightness) + (1.0 - eScreen->vpSaturation) / 2.0));
++ /* Texture rendering set-up */
++ //eScreen->gScreen->setTexEnvMode(GL_MODULATE);
++ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
++ /* Draw the dim texture with all of it's modified
++ * geometry glory */
++ gWindow->glDrawTextureSetCurrentIndex(MAXSHORT);
++ gWindow->glDrawTexture(tex, transform, eAttrib, mask |
++ PAINT_WINDOW_BLEND_MASK |
++ PAINT_WINDOW_TRANSLUCENT_MASK |
++ PAINT_WINDOW_TRANSFORMED_MASK);
++ gWindow->glDrawTextureSetCurrentIndex(glDrawTextureIndex);
++ /* Texture rendering tear-down */
++ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
++ eScreen->gScreen->setTexEnvMode(GL_REPLACE);
+ }
+
+ /* Paint the outline */
+@@ -1307,9 +1447,10 @@
+ if (region.numRects ())
+ {
+ /* reset geometry and paint */
+- gWindow->geometry ().reset ();
++ gWindow->vertexBuffer ()->begin ();
++ gWindow->vertexBuffer ()->end ();
+
+- paintGlow (fragment, infiniteRegion, mask);
++ paintGlow (transform, attrib, infiniteRegion, mask);
+ }
+ }
+
+@@ -1322,17 +1463,18 @@
+ #define EXPO_GRID_SIZE 100
+
+ void
+-ExpoWindow::glAddGeometry (const GLTexture::MatrixList& matrices,
+- const CompRegion& region,
+- const CompRegion& clip,
+- unsigned int maxGridWidth,
+- unsigned int maxGridHeight)
++ExpoWindow::glAddGeometry (const GLTexture::MatrixList &matrices,
++ const CompRegion ®ion,
++ const CompRegion &clip,
++ unsigned int maxGridWidth,
++ unsigned int maxGridHeight)
+ {
+ if (eScreen->expoCam > 0.0 &&
+ screen->desktopWindowCount () &&
+ eScreen->optionGetDeform () == ExpoScreen::DeformCurve)
+ {
+- int i, oldVCount = gWindow->geometry ().vCount;
++ #warning Curve not ported, needs shaders now
++/* int i, oldVCount = gWindow->geometry ().vCount;
+ GLfloat *v;
+ CompPoint offset;
+ float lastX, lastZ = 0.0;
+@@ -1377,7 +1519,7 @@
+ lastZ = v[2];
+
+ v += gWindow->geometry ().vertexStride;
+- }
++ } */
+ }
+ else
+ {
+@@ -1386,16 +1528,18 @@
+ }
+
+ void
+-ExpoWindow::glDrawTexture (GLTexture *texture,
+- GLFragment::Attrib& attrib,
+- unsigned int mask)
++ExpoWindow::glDrawTexture (GLTexture *texture,
++ const GLMatrix &transform,
++ const GLWindowPaintAttrib &attrib,
++ unsigned int mask)
+ {
+ if (eScreen->expoCam > 0.0 &&
+ eScreen->optionGetDeform () == ExpoScreen::DeformCurve &&
+ eScreen->gScreen->lighting () &&
+ screen->desktopWindowCount ())
+ {
+- unsigned int i, idx, vCount;
++ #warning Curve not ported, needs shaders now
++/* unsigned int i, idx, vCount;
+ CompPoint offset;
+ float x;
+ GLfloat *v;
+@@ -1442,13 +1586,13 @@
+
+ glDisable (GL_NORMALIZE);
+ glDisableClientState (GL_NORMAL_ARRAY);
+- glNormal3f (0.0, 0.0, -1.0);
++ glNormal3f (0.0, 0.0, -1.0); */
+ }
+ else
+ {
+- glEnable (GL_NORMALIZE);
+- gWindow->glDrawTexture (texture, attrib, mask);
+- glDisable (GL_NORMALIZE);
++// glEnable (GL_NORMALIZE);
++ gWindow->glDrawTexture (texture, transform, attrib, mask);
++// glDisable (GL_NORMALIZE);
+ }
+ }
+
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/expo/src/expo.h compiz-plugins-main-gles2/expo/src/expo.h
+--- compiz-plugins-main-package/expo/src/expo.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/expo/src/expo.h 2012-04-05 12:29:41.374453000 +0200
+@@ -29,9 +29,6 @@
+ #include <composite/composite.h>
+ #include <opengl/opengl.h>
+
+-#include <cairo-xlib-xrender.h>
+-#include <cairo.h>
+-
+ #include "expo_options.h"
+ #include "glow.h"
+
+@@ -60,20 +57,20 @@
+ void donePaint ();
+
+ bool glPaintOutput (const GLScreenPaintAttrib&, const GLMatrix&,
+- const CompRegion&, CompOutput *, unsigned int);
++ const CompRegion&, CompOutput *, unsigned int);
+ void glPaintTransformedOutput (const GLScreenPaintAttrib&,
+- const GLMatrix&, const CompRegion&,
+- CompOutput *, unsigned int);
++ const GLMatrix&, const CompRegion&,
++ CompOutput*, unsigned int);
+
+ const CompWindowList & getWindowPaintList ();
+
+- bool dndInit (CompAction *, CompAction::State, CompOption::Vector&);
+- bool dndFini (CompAction *, CompAction::State, CompOption::Vector&);
+- bool doExpo (CompAction *, CompAction::State, CompOption::Vector&);
+- bool exitExpo (CompAction *, CompAction::State, CompOption::Vector&);
+- bool termExpo (CompAction *, CompAction::State, CompOption::Vector&);
+- bool nextVp (CompAction *, CompAction::State, CompOption::Vector&);
+- bool prevVp (CompAction *, CompAction::State, CompOption::Vector&);
++ bool dndInit (CompAction*, CompAction::State, CompOption::Vector&);
++ bool dndFini (CompAction*, CompAction::State, CompOption::Vector&);
++ bool doExpo (CompAction*, CompAction::State, CompOption::Vector&);
++ bool exitExpo (CompAction*, CompAction::State, CompOption::Vector&);
++ bool termExpo (CompAction*, CompAction::State, CompOption::Vector&);
++ bool nextVp (CompAction*, CompAction::State, CompOption::Vector&);
++ bool prevVp (CompAction*, CompAction::State, CompOption::Vector&);
+
+ CompPoint currentViewport ();
+
+@@ -144,9 +141,9 @@
+ void updateWraps (bool);
+
+ void invertTransformedVertex (const GLScreenPaintAttrib&,
+- const GLMatrix&, CompOutput *, int[2]);
++ const GLMatrix&, CompOutput *, int[2]);
+ void paintWall (const GLScreenPaintAttrib&, const GLMatrix&,
+- const CompRegion&, CompOutput *, unsigned int, bool);
++ const CompRegion&, CompOutput *, unsigned int, bool);
+
+ void paintViewport (const GLScreenPaintAttrib& attrib,
+ const GLMatrix& transform,
+@@ -181,18 +178,18 @@
+
+ void resizeNotify (int dx, int dy, int dw, int dh);
+
+- bool glDraw (const GLMatrix&, GLFragment::Attrib&,
+- const CompRegion&, unsigned int);
++ bool glDraw (const GLMatrix&, const GLWindowPaintAttrib&,
++ const CompRegion&, unsigned int);
+ bool glPaint (const GLWindowPaintAttrib&, const GLMatrix&,
+- const CompRegion&, unsigned int);
++ const CompRegion&, unsigned int);
+ void glAddGeometry (const GLTexture::MatrixList&,
+- const CompRegion&, const CompRegion&,
+- unsigned int, unsigned int);
+- void glDrawTexture (GLTexture *, GLFragment::Attrib& attrib,
+- unsigned int);
+-
++ const CompRegion&, const CompRegion&,
++ unsigned int, unsigned int);
++ void glDrawTexture (GLTexture*, const GLMatrix&,
++ const GLWindowPaintAttrib&, unsigned int);
+ void
+- paintGlow (GLFragment::Attrib &attrib,
++ paintGlow (const GLMatrix &transform,
++ const GLWindowPaintAttrib &attrib,
+ const CompRegion &paintRegion,
+ unsigned int mask);
+
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/expo/src/glow.cpp compiz-plugins-main-gles2/expo/src/glow.cpp
+--- compiz-plugins-main-package/expo/src/glow.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/expo/src/glow.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -42,12 +42,24 @@
+ */
+
+ void
+-ExpoWindow::paintGlow (GLFragment::Attrib &attrib,
+- const CompRegion &paintRegion,
+- unsigned int mask)
++ExpoWindow::paintGlow (const GLMatrix &transform,
++ const GLWindowPaintAttrib &attrib,
++ const CompRegion &paintRegion,
++ unsigned int mask)
+ {
+- CompRegion reg;
+- int i;
++ CompRegion reg;
++ int i;
++ GLushort colorData[4];
++ const GLushort *selColorData = ExpoScreen::get (screen)->optionGetSelectedColor ();
++ float alpha = (float) selColorData[3] / 65535.0f;
++
++ /* Premultiply color */
++ colorData[0] = selColorData[0] * alpha;
++ colorData[1] = selColorData[1] * alpha;
++ colorData[2] = selColorData[2] * alpha;
++ colorData[3] = selColorData[3];
++
++ gWindow->vertexBuffer ()->begin ();
+
+ /* There are 8 glow parts of the glow texture which we wish to paint
+ * separately with different transformations
+@@ -67,42 +79,30 @@
+ reg.boundingRect ().height ());
+
+ matl.push_back (mGlowQuads[i].mMatrix);
++ /* Add color data for all 6 vertices of the quad */
++ for (int n = 0; n < 6; n++)
++ gWindow->vertexBuffer ()->addColors (1, colorData);
+ gWindow->glAddGeometry (matl, reg, paintRegion);
+ }
+ }
+
+- /* If the geometry add succeeded */
+- if (gWindow->geometry ().vertices)
+- {
+- GLFragment::Attrib fAttrib (attrib);
+- GLushort average;
+- GLushort color[3] = {MAXSHORT,
+- MAXSHORT,
+- MAXSHORT};
+-
+- float alpha = (float) ExpoScreen::get (screen)->optionGetSelectedColorAlpha () / 65535.0f;
+-
+- GLScreen::get (screen)->setTexEnvMode (GL_MODULATE);
+- glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+- glColor4f (((float) ExpoScreen::get (screen)->optionGetSelectedColorRed () / 65535.0f) * alpha,
+- ((float) ExpoScreen::get (screen)->optionGetSelectedColorGreen () / 65535.0f) * alpha,
+- ((float) ExpoScreen::get (screen)->optionGetSelectedColorBlue () / 65535.0f) * alpha,
+- alpha);
+-
+- /* we use PAINT_WINDOW_TRANSFORMED_MASK here to force
+- the usage of a good texture filter */
+- foreach (GLTexture *tex, ExpoScreen::get (screen)->outline_texture)
+- {
+- gWindow->glDrawTexture (tex, fAttrib, mask |
+- PAINT_WINDOW_BLEND_MASK |
+- PAINT_WINDOW_TRANSLUCENT_MASK |
+- PAINT_WINDOW_TRANSFORMED_MASK);
+- }
++ gWindow->vertexBuffer ()->end ();
+
+- glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+- GLScreen::get (screen)->setTexEnvMode (GL_REPLACE);
+- glColor4usv (defaultColor);
++ //GLScreen::get (screen)->setTexEnvMode (GL_MODULATE);
++ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
++
++ /* we use PAINT_WINDOW_TRANSFORMED_MASK here to force
++ the usage of a good texture filter */
++ foreach (GLTexture *tex, ExpoScreen::get (screen)->outline_texture)
++ {
++ gWindow->glDrawTexture (tex, transform, attrib, mask |
++ PAINT_WINDOW_BLEND_MASK |
++ PAINT_WINDOW_TRANSLUCENT_MASK |
++ PAINT_WINDOW_TRANSFORMED_MASK);
+ }
++
++ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
++ GLScreen::get (screen)->setTexEnvMode (GL_REPLACE);
+ }
+
+ /*
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/ezoom/ezoom.xml.in compiz-plugins-main-gles2/ezoom/ezoom.xml.in
+--- compiz-plugins-main-package/ezoom/ezoom.xml.in 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/ezoom/ezoom.xml.in 2012-04-05 12:29:41.374453000 +0200
+@@ -29,6 +29,7 @@
+ <option type="button" name="zoom_in_button">
+ <_short>Zoom In</_short>
+ <_long>Zoom In</_long>
++ <default><Super>Button4</default>
+ </option>
+ <option type="key" name="zoom_in_key">
+ <_short>Zoom In</_short>
+@@ -37,6 +38,7 @@
+ <option type="button" name="zoom_out_button">
+ <_short>Zoom Out</_short>
+ <_long>Zoom Out</_long>
++ <default><Super>Button5</default>
+ </option>
+ <option type="key" name="zoom_out_key">
+ <_short>Zoom Out</_short>
+@@ -45,6 +47,7 @@
+ <option type="button" name="zoom_box_button">
+ <_short>Zoom Box</_short>
+ <_long>Zoom in on a boxed area</_long>
++ <default><Super>Button2</default>
+ </option>
+ </group>
+ <group>
+@@ -138,7 +141,7 @@
+ <option type="key" name="fit_to_window_key">
+ <_short>Fit zoomed area to window</_short>
+ <_long>Zooms in/out so the focused window is zoomed to the maximum while still being fully visible.</_long>
+- <default></default>
++ <default><Super>r</default>
+ </option>
+ </subgroup>
+ </group>
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/ezoom/src/ezoom.cpp compiz-plugins-main-gles2/ezoom/src/ezoom.cpp
+--- compiz-plugins-main-package/ezoom/src/ezoom.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/ezoom/src/ezoom.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -378,13 +378,16 @@
+ /* Draws a box from the screen coordinates inx1,iny1 to inx2,iny2 */
+ void
+ EZoomScreen::drawBox (const GLMatrix &transform,
+- CompOutput *output,
+- CompRect box)
++ CompOutput *output,
++ CompRect box)
+ {
+- GLMatrix zTransform = transform;
+- int x1,x2,y1,y2;
+- int inx1, inx2, iny1, iny2;
+- int out = output->id ();
++ GLMatrix zTransform (transform);
++ int x1, x2, y1, y2;
++ int inx1, inx2, iny1, iny2;
++ int out = output->id ();
++ GLushort colorData[4];
++ GLfloat vertexData[12];
++ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
+
+ zTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
+ convertToZoomed (out, box.x1 (), box.y1 (), &inx1, &iny1);
+@@ -394,23 +397,61 @@
+ y1 = MIN (iny1, iny2);
+ x2 = MAX (inx1, inx2);
+ y2 = MAX (iny1, iny2);
+- glPushMatrix ();
+- glLoadMatrixf (zTransform.getMatrix ());
+- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
+- glEnable (GL_BLEND);
+- glColor4us (0x2fff, 0x2fff, 0x4fff, 0x4fff);
+- glRecti (x1,y2,x2,y1);
+- glColor4us (0x2fff, 0x2fff, 0x4fff, 0x9fff);
+- glBegin (GL_LINE_LOOP);
+- glVertex2i (x1, y1);
+- glVertex2i (x2, y1);
+- glVertex2i (x2, y2);
+- glVertex2i (x1, y2);
+- glEnd ();
+- glColor4usv (defaultColor);
+- glDisable (GL_BLEND);
+- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
+- glPopMatrix ();
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ colorData[0] = 0x2fff;
++ colorData[1] = 0x2fff;
++ colorData[2] = 0x2fff;
++ colorData[3] = 0x4fff;
++
++ streamingBuffer->addColors (1, colorData);
++
++ vertexData[0] = x1;
++ vertexData[1] = y1;
++ vertexData[2] = 0.0f;
++ vertexData[3] = x1;
++ vertexData[4] = y2;
++ vertexData[5] = 0.0f;
++ vertexData[6] = x2;
++ vertexData[7] = y1;
++ vertexData[8] = 0.0f;
++ vertexData[9] = x2;
++ vertexData[10] = y2;
++ vertexData[11] = 0.0f;
++
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (zTransform);
++
++
++ streamingBuffer->begin (GL_LINE_LOOP);
++
++ colorData[0] = 0x2fff;
++ colorData[1] = 0x2fff;
++ colorData[2] = 0x4fff;
++ colorData[3] = 0x9fff;
++
++ streamingBuffer->addColors (1, colorData);
++
++ vertexData[0] = x1;
++ vertexData[1] = y1;
++ vertexData[2] = 0.0f;
++ vertexData[3] = x2;
++ vertexData[4] = y1;
++ vertexData[5] = 0.0f;
++ vertexData[6] = x2;
++ vertexData[7] = y2;
++ vertexData[8] = 0.0f;
++ vertexData[9] = x1;
++ vertexData[10] = y2;
++ vertexData[11] = 0.0f;
++
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (zTransform);
+ }
+ /* Apply the zoom if we are grabbed.
+ * Make sure to use the correct filter.
+@@ -1050,22 +1091,25 @@
+
+ /* Translate into place and draw the scaled cursor. */
+ void
+-EZoomScreen::drawCursor (CompOutput *output,
+- const GLMatrix &transform)
++EZoomScreen::drawCursor (CompOutput *output,
++ const GLMatrix &transform)
+ {
+- int out = output->id ();
++ int out = output->id ();
+
+ if (cursor.isSet)
+ {
+- GLMatrix sTransform = transform;
+- float scaleFactor;
+- int ax, ay, x, y;
++ GLMatrix sTransform (transform);
++ float scaleFactor;
++ int ax, ay, x, y;
++ GLfloat textureData[8];
++ GLfloat vertexData[12];
++ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
+
+ /*
+ * XXX: expo knows how to handle mouse when zoomed, so we back off
+ * when expo is active.
+ */
+- if (screen->grabExist ( "expo"))
++ if (screen->grabExist ("expo"))
+ {
+ cursorZoomInactive ();
+ return;
+@@ -1073,63 +1117,77 @@
+
+ sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
+ convertToZoomed (out, mouse.x (), mouse.y (), &ax, &ay);
+- glPushMatrix ();
+- glLoadMatrixf (sTransform.getMatrix ());
+- glTranslatef ((float) ax, (float) ay, 0.0f);
++ sTransform.translate ((float) ax, (float) ay, 0.0f);
++
+ if (optionGetScaleMouseDynamic ())
+ scaleFactor = 1.0f / zooms.at (out).currentZoom;
+ else
+ scaleFactor = 1.0f / optionGetScaleMouseStatic ();
+- glScalef (scaleFactor,
+- scaleFactor,
+- 1.0f);
++
++ sTransform.scale (scaleFactor, scaleFactor, 1.0f);
+ x = -cursor.hotX;
+ y = -cursor.hotY;
+
+- glEnable (GL_BLEND);
+- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, cursor.texture);
+- glEnable (GL_TEXTURE_RECTANGLE_ARB);
+-
+- glBegin (GL_QUADS);
+- glTexCoord2d (0, 0);
+- glVertex2f (x, y);
+- glTexCoord2d (0, cursor.height);
+- glVertex2f (x, y + cursor.height);
+- glTexCoord2d (cursor.width, cursor.height);
+- glVertex2f (x + cursor.width, y + cursor.height);
+- glTexCoord2d (cursor.width, 0);
+- glVertex2f (x + cursor.width, y);
+- glEnd ();
+- glDisable (GL_BLEND);
+- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
+- glDisable (GL_TEXTURE_RECTANGLE_ARB);
+- glPopMatrix ();
++ glBindTexture (GL_TEXTURE_2D, cursor.texture);
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ vertexData[0] = x;
++ vertexData[1] = y;
++ vertexData[2] = 0.0f;
++ vertexData[3] = x;
++ vertexData[4] = y + cursor.height;
++ vertexData[5] = 0.0f;
++ vertexData[6] = x + cursor.width;
++ vertexData[7] = y;
++ vertexData[8] = 0.0f;
++ vertexData[9] = x + cursor.width;
++ vertexData[10] = y + cursor.height;
++ vertexData[11] = 0.0f;
++
++ streamingBuffer->addVertices (4, vertexData);
++
++ textureData[0] = 0;
++ textureData[1] = 0;
++ textureData[2] = 0;
++ textureData[3] = cursor.height;
++ textureData[4] = cursor.width;
++ textureData[5] = 0;
++ textureData[6] = cursor.width;
++ textureData[7] = cursor.height;
++
++ streamingBuffer->addTexCoords (1, 4, textureData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (sTransform);
++
++ glBindTexture (GL_TEXTURE_2D, 0);
+ }
+ }
+
+ /* Create (if necessary) a texture to store the cursor,
+ * fetch the cursor with XFixes. Store it. */
+ void
+-EZoomScreen::updateCursor (CursorTexture * cursor)
++EZoomScreen::updateCursor (CursorTexture *cursor)
+ {
+ unsigned char *pixels;
+- int i;
++ int i;
+ Display *dpy = screen->dpy ();
+
+ if (!cursor->isSet)
+ {
+ cursor->isSet = true;
+ cursor->screen = screen;
+- glEnable (GL_TEXTURE_RECTANGLE_ARB);
++
++ glEnable (GL_TEXTURE_2D);
+ glGenTextures (1, &cursor->texture);
+- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, cursor->texture);
++ glBindTexture (GL_TEXTURE_2D, cursor->texture);
+
+- glTexParameteri (GL_TEXTURE_RECTANGLE_ARB,
+- GL_TEXTURE_WRAP_S, GL_CLAMP);
+- glTexParameteri (GL_TEXTURE_RECTANGLE_ARB,
+- GL_TEXTURE_WRAP_T, GL_CLAMP);
+- } else {
+- glEnable (GL_TEXTURE_RECTANGLE_ARB);
++ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
++ glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
++ }
++ else {
++ glEnable (GL_TEXTURE_2D);
+ }
+
+ XFixesCursorImage *ci = XFixesGetCursorImage (dpy);
+@@ -1185,11 +1243,11 @@
+ compLogMessage ("ezoom", CompLogLevelWarn, "unable to get system cursor image!");
+ }
+
+- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, cursor->texture);
+- glTexImage2D (GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, cursor->width,
++ glBindTexture (GL_TEXTURE_2D, cursor->texture);
++ glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, cursor->width,
+ cursor->height, 0, GL_BGRA, GL_UNSIGNED_BYTE, pixels);
+- glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0);
+- glDisable (GL_TEXTURE_RECTANGLE_ARB);
++ glBindTexture (GL_TEXTURE_2D, 0);
++ glDisable (GL_TEXTURE_2D);
+
+ free (pixels);
+ }
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/glow.cpp compiz-plugins-main-gles2/glow.cpp
+--- compiz-plugins-main-package/glow.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/glow.cpp 1970-01-01 01:00:00.000000000 +0100
+@@ -1,428 +0,0 @@
+-/**
+- *
+- * Compiz group plugin
+- *
+- * glow.cpp
+- *
+- * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen,
+- * Danny Baumann, Sam Spilsbury
+- * Authors: Patrick Niklaus <patrick.niklaus@xxxxxxxxxxxxxx>
+- * Roi Cohen <roico.beryl@xxxxxxxxx>
+- * Danny Baumann <maniac@xxxxxxxxxxxxxxxxxxx>
+- * Sam Spilsbury <smspillaz@xxxxxxxxx>
+- *
+- *
+- * This program is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU General Public License
+- * as published by the Free Software Foundation; either version 2
+- * of the License, or (at your option) any later version.
+- *
+- * This program is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- * GNU General Public License for more details.
+- *
+- **/
+-
+-#include "expo.h"
+-#include "group_glow.h"
+-
+-const GlowTextureProperties glowTextureProperties = {
+- /* GlowTextureRectangular */
+- glowTexRect, 32, 21
+-};
+-
+-/*
+- * GroupWindow::paintGlow
+- *
+- * Takes our glow texture, stretches the appropriate positions in the glow texture,
+- * adds those geometries (so plugins like wobby and deform this texture correctly)
+- * and then draws the glow texture with this geometry (plugins like wobbly and friends
+- * will automatically deform the texture based on our set geometry)
+- */
+-
+-void
+-ExpoWindow::paintGlow (GLFragment::Attrib &attrib,
+- const CompRegion &paintRegion,
+- unsigned int mask)
+-{
+- CompRegion reg;
+- int i;
+-
+- /* There are 8 glow parts of the glow texture which we wish to paint
+- * separately with different transformations
+- */
+- for (i = 0; i < NUM_GLOWQUADS; i++)
+- {
+- /* Using precalculated quads here */
+- reg = CompRegion (mGlowQuads[i].mBox);
+-
+- if (reg.boundingRect ().x1 () < reg.boundingRect ().x2 () &&
+- reg.boundingRect ().y1 () < reg.boundingRect ().y2 ())
+- {
+- GLTexture::MatrixList matl;
+- reg = CompRegion (reg.boundingRect ().x1 (),
+- reg.boundingRect ().y1 (),
+- reg.boundingRect ().width (),
+- reg.boundingRect ().height ());
+-
+- matl.push_back (mGlowQuads[i].mMatrix);
+- gWindow->glAddGeometry (matl, reg, paintRegion);
+- }
+- }
+-
+- /* If the geometry add succeeded */
+- if (gWindow->geometry ().vertices)
+- {
+- GLFragment::Attrib fAttrib (attrib);
+- GLushort average;
+- GLushort color[3] = {MAXSHORT,
+- MAXSHORT,
+- MAXSHORT};
+-
+- float alpha = (float) ExpoScreen::get (screen)->optionGetSelectedColorAlpha () / 65535.0f;
+-
+- GLScreen::get (screen)->setTexEnvMode (GL_MODULATE);
+- glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+- glColor4f (((float) ExpoScreen::get (screen)->optionGetSelectedColorRed () / 65535.0f) * alpha,
+- ((float) ExpoScreen::get (screen)->optionGetSelectedColorGreen () / 65535.0f) * alpha,
+- ((float) ExpoScreen::get (screen)->optionGetSelectedColorBlue () / 65535.0f) * alpha,
+- alpha);
+-
+- /* we use PAINT_WINDOW_TRANSFORMED_MASK here to force
+- the usage of a good texture filter */
+- foreach (GLTexture *tex, ExpoScreen::get (screen)->outline_texture)
+- {
+- gWindow->glDrawTexture (tex, fAttrib, mask |
+- PAINT_WINDOW_BLEND_MASK |
+- PAINT_WINDOW_TRANSLUCENT_MASK |
+- PAINT_WINDOW_TRANSFORMED_MASK);
+- }
+-
+- glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+- GLScreen::get (screen)->setTexEnvMode (GL_REPLACE);
+- glColor4usv (defaultColor);
+- }
+-}
+-
+-/*
+- * ExpoWindow::computeGlowQuads
+- *
+- * This function computures the matrix transformation required for each
+- * part of the glow texture which we wish to stretch to some rectangular
+- * dimentions
+- *
+- * There are eight quads different parts of the texture which we wish to
+- * paint here, the 4 sides and four corners, eg:
+- *
+- * ------------------
+- * | 1 | 4 | 6 |
+- * ------------- ------------------
+- * | 1 | 4 | 6 | | | | |
+- * ------------- | | | |
+- * | 2 | n | 7 | -> | 2 | n | 7 |
+- * ------------- | | | |
+- * | 3 | 5 | 8 | | | | |
+- * ------------- ------------------
+- * | 3 | 5 | 8 |
+- * ------------------
+- *
+- * In this example here, 2, 4, 5 and 7 are stretched, and the matrices for
+- * each quad rect adjusted accordingly for it's size compared to the original
+- * texture size.
+- *
+- * When we are adjusting the matrices here, the initial size of each corner has
+- * a size of of "1.0f", so according to 2x2 matrix rules,
+- * the scale factor is the inverse of the size of the glow (which explains
+- * while you will see here that matrix->xx is (1 / glowSize)
+- * where glowSize is the size the user specifies they want their glow to extend.
+- * (likewise, matrix->yy is adjusted similarly for corners and for top/bottom)
+- *
+- * matrix->x0 and matrix->y0 here are set to be the top left edge of the rect
+- * adjusted by the matrix scale factor (matrix->xx and matrix->yy)
+- *
+- */
+-void
+-ExpoWindow::computeGlowQuads (GLTexture::Matrix *matrix)
+-{
+- CompRect *box;
+- int x1, x2, y1, y2;
+- GLTexture::Matrix *quadMatrix;
+- int glowSize, glowOffset;
+- CompWindow *w = window;
+-
+- /* Passing NULL to this function frees the glow quads
+- * (so the window is not painted with glow) */
+-
+- if (matrix)
+- {
+- if (!mGlowQuads)
+- mGlowQuads = new GlowQuad[NUM_GLOWQUADS];
+- if (!mGlowQuads)
+- return;
+- }
+- else
+- {
+- if (mGlowQuads)
+- {
+- delete[] mGlowQuads;
+- mGlowQuads = NULL;
+- }
+- return;
+- }
+-
+- glowSize = 48;
+- glowOffset = (glowSize * ExpoScreen::get (screen)->mGlowTextureProperties->glowOffset /
+- ExpoScreen::get (screen)->mGlowTextureProperties->textureSize) + 1;
+-
+- /* Top left corner */
+- box = &mGlowQuads[GLOWQUAD_TOPLEFT].mBox;
+- mGlowQuads[GLOWQUAD_TOPLEFT].mMatrix = *matrix;
+- quadMatrix = &mGlowQuads[GLOWQUAD_TOPLEFT].mMatrix;
+-
+- /* Set the desired rect dimentions
+- * for the part of the glow we are painting */
+-
+- x1 = WIN_REAL_X (w) - glowSize + glowOffset;
+- y1 = WIN_REAL_Y (w) - glowSize + glowOffset;
+-
+- /* 2x2 Matrix here, adjust both x and y scale factors
+- * and the x and y position
+- *
+- * Scaling both parts of the texture in a positive direction
+- * here (left to right top to bottom)
+- *
+- * The base position (x0 and y0) here requires us to move backwards
+- * on the x and y dimentions by the calculated rect dimentions
+- * multiplied by the scale factors
+- */
+-
+- quadMatrix->xx = 1.0f / glowSize;
+- quadMatrix->yy = 1.0f / (glowSize);
+- quadMatrix->x0 = -(x1 * quadMatrix->xx);
+- quadMatrix->y0 = -(y1 * quadMatrix->yy);
+-
+- x2 = MIN (WIN_REAL_X (w) + glowOffset,
+- WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));
+- y2 = MIN (WIN_REAL_Y (w) + glowOffset,
+- WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));
+-
+- *box = CompRect (x1, y1, x2 - x1, y2 - y1);
+-
+- /* Top right corner */
+- box = &mGlowQuads[GLOWQUAD_TOPRIGHT].mBox;
+- mGlowQuads[GLOWQUAD_TOPRIGHT].mMatrix = *matrix;
+- quadMatrix = &mGlowQuads[GLOWQUAD_TOPRIGHT].mMatrix;
+-
+- /* Set the desired rect dimentions
+- * for the part of the glow we are painting */
+-
+- x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
+- y1 = WIN_REAL_Y (w) - glowSize + glowOffset;
+- x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset;
+-
+- /* 2x2 Matrix here, adjust both x and y scale factors
+- * and the x and y position
+- *
+- * Scaling the y part of the texture in a positive direction
+- * and the x part in a negative direction here
+- * (right to left top to bottom)
+- *
+- * The base position (x0 and y0) here requires us to move backwards
+- * on the y dimention and forwards on x by the calculated rect dimentions
+- * multiplied by the scale factors (since we are moving forward on x we
+- * need the inverse of that which is 1 - x1 * xx
+- */
+-
+- quadMatrix->xx = -1.0f / glowSize;
+- quadMatrix->yy = 1.0f / glowSize;
+- quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);
+- quadMatrix->y0 = -(y1 * quadMatrix->yy);
+-
+- x1 = MAX (WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset,
+- WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));
+- y2 = MIN (WIN_REAL_Y (w) + glowOffset,
+- WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));
+-
+- *box = CompRect (x1, y1, x2 - x1, y2 - y1);
+-
+- /* Bottom left corner */
+- box = &mGlowQuads[GLOWQUAD_BOTTOMLEFT].mBox;
+- mGlowQuads[GLOWQUAD_BOTTOMLEFT].mMatrix = *matrix;
+- quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOMLEFT].mMatrix;
+-
+- x1 = WIN_REAL_X (w) - glowSize + glowOffset;
+- y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
+- x2 = WIN_REAL_X (w) + glowOffset;
+- y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset;
+-
+- /* 2x2 Matrix here, adjust both x and y scale factors
+- * and the x and y position
+- *
+- * Scaling the x part of the texture in a positive direction
+- * and the y part in a negative direction here
+- * (left to right bottom to top)
+- *
+- * The base position (x0 and y0) here requires us to move backwards
+- * on the x dimention and forwards on y by the calculated rect dimentions
+- * multiplied by the scale factors (since we are moving forward on x we
+- * need the inverse of that which is 1 - y1 * yy
+- */
+-
+- quadMatrix->xx = 1.0f / glowSize;
+- quadMatrix->yy = -1.0f / glowSize;
+- quadMatrix->x0 = -(x1 * quadMatrix->xx);
+- quadMatrix->y0 = 1.0f - (y1 * quadMatrix->yy);
+-
+- y1 = MAX (WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset,
+- WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));
+- x2 = MIN (WIN_REAL_X (w) + glowOffset,
+- WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));
+-
+- *box = CompRect (x1, y1, x2 - x1, y2 - y1);
+-
+- /* Bottom right corner */
+- box = &mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mBox;
+- mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mMatrix = *matrix;
+- quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOMRIGHT].mMatrix;
+-
+- x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
+- y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
+- x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset;
+- y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset;
+-
+- /* 2x2 Matrix here, adjust both x and y scale factors
+- * and the x and y position
+- *
+- * Scaling the both parts of the texture in a negative direction
+- * (right to left bottom to top)
+- *
+- * The base position (x0 and y0) here requires us to move forwards
+- * on both dimentions by the calculated rect dimentions
+- * multiplied by the scale factors
+- */
+-
+- quadMatrix->xx = -1.0f / glowSize;
+- quadMatrix->yy = -1.0f / glowSize;
+- quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);
+- quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy);
+-
+- x1 = MAX (WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset,
+- WIN_REAL_X (w) + (WIN_REAL_WIDTH (w) / 2));
+- y1 = MAX (WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset,
+- WIN_REAL_Y (w) + (WIN_REAL_HEIGHT (w) / 2));
+-
+- *box = CompRect (x1, y1, x2 - x1, y2 - y1);
+-
+- /* Top edge */
+- box = &mGlowQuads[GLOWQUAD_TOP].mBox;
+- mGlowQuads[GLOWQUAD_TOP].mMatrix = *matrix;
+- quadMatrix = &mGlowQuads[GLOWQUAD_TOP].mMatrix;
+-
+- x1 = WIN_REAL_X (w) + glowOffset;
+- y1 = WIN_REAL_Y (w) - glowSize + glowOffset;
+- x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
+- y2 = WIN_REAL_Y (w) + glowOffset;
+-
+- /* 2x2 Matrix here, adjust both x and y scale factors
+- * and the x and y position
+- *
+- * No need to scale the x part of the texture here, but we
+- * are scaling on the y part in a positive direciton
+- *
+- * The base position (y0) here requires us to move backwards
+- * on the x dimention and forwards on y by the calculated rect dimentions
+- * multiplied by the scale factors
+- */
+-
+- quadMatrix->xx = 0.0f;
+- quadMatrix->yy = 1.0f / glowSize;
+- quadMatrix->x0 = 1.0;
+- quadMatrix->y0 = -(y1 * quadMatrix->yy);
+-
+- *box = CompRect (x1, y1, x2 - x1, y2 - y1);
+-
+- /* Bottom edge */
+- box = &mGlowQuads[GLOWQUAD_BOTTOM].mBox;
+- mGlowQuads[GLOWQUAD_BOTTOM].mMatrix = *matrix;
+- quadMatrix = &mGlowQuads[GLOWQUAD_BOTTOM].mMatrix;
+-
+- x1 = WIN_REAL_X (w) + glowOffset;
+- y1 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
+- x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
+- y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) + glowSize - glowOffset;
+-
+- /* 2x2 Matrix here, adjust both x and y scale factors
+- * and the x and y position
+- *
+- * No need to scale the x part of the texture here, but we
+- * are scaling on the y part in a negative direciton
+- *
+- * The base position (y0) here requires us to move forwards
+- * on y by the calculated rect dimentions
+- * multiplied by the scale factors
+- */
+-
+- quadMatrix->xx = 0.0f;
+- quadMatrix->yy = -1.0f / glowSize;
+- quadMatrix->x0 = 1.0;
+- quadMatrix->y0 = 1.0 - (y1 * quadMatrix->yy);
+-
+- *box = CompRect (x1, y1, x2 - x1, y2 - y1);
+-
+- /* Left edge */
+- box = &mGlowQuads[GLOWQUAD_LEFT].mBox;
+- mGlowQuads[GLOWQUAD_LEFT].mMatrix = *matrix;
+- quadMatrix = &mGlowQuads[GLOWQUAD_LEFT].mMatrix;
+-
+- x1 = WIN_REAL_X (w) - glowSize + glowOffset;
+- y1 = WIN_REAL_Y (w) + glowOffset;
+- x2 = WIN_REAL_X (w) + glowOffset;
+- y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
+-
+- /* 2x2 Matrix here, adjust both x and y scale factors
+- * and the x and y position
+- *
+- * No need to scale the y part of the texture here, but we
+- * are scaling on the x part in a positive direciton
+- *
+- * The base position (x0) here requires us to move backwards
+- * on x by the calculated rect dimentions
+- * multiplied by the scale factors
+- */
+-
+- quadMatrix->xx = 1.0f / glowSize;
+- quadMatrix->yy = 0.0f;
+- quadMatrix->x0 = -(x1 * quadMatrix->xx);
+- quadMatrix->y0 = 1.0;
+-
+- *box = CompRect (x1, y1, x2 - x1, y2 - y1);
+-
+- /* Right edge */
+- box = &mGlowQuads[GLOWQUAD_RIGHT].mBox;
+- mGlowQuads[GLOWQUAD_RIGHT].mMatrix = *matrix;
+- quadMatrix = &mGlowQuads[GLOWQUAD_RIGHT].mMatrix;
+-
+- x1 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) - glowOffset;
+- y1 = WIN_REAL_Y (w) + glowOffset;
+- x2 = WIN_REAL_X (w) + WIN_REAL_WIDTH (w) + glowSize - glowOffset;
+- y2 = WIN_REAL_Y (w) + WIN_REAL_HEIGHT (w) - glowOffset;
+-
+- /* 2x2 Matrix here, adjust both x and y scale factors
+- * and the x and y position
+- *
+- * No need to scale the y part of the texture here, but we
+- * are scaling on the x part in a negative direciton
+- *
+- * The base position (x0) here requires us to move forwards
+- * on x by the calculated rect dimentions
+- * multiplied by the scale factors
+- */
+-
+- quadMatrix->xx = -1.0f / glowSize;
+- quadMatrix->yy = 0.0f;
+- quadMatrix->x0 = 1.0 - (x1 * quadMatrix->xx);
+- quadMatrix->y0 = 1.0;
+-
+- *box = CompRect (x1, y1, x2 - x1, y2 - y1);
+-}
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/glow.h compiz-plugins-main-gles2/glow.h
+--- compiz-plugins-main-package/glow.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/glow.h 1970-01-01 01:00:00.000000000 +0100
+@@ -1,66 +0,0 @@
+-/**
+- *
+- * Compiz group plugin
+- *
+- * glow.h
+- *
+- * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen,
+- * Danny Baumann, Sam Spilsbury
+- * Authors: Patrick Niklaus <patrick.niklaus@xxxxxxxxxxxxxx>
+- * Roi Cohen <roico.beryl@xxxxxxxxx>
+- * Danny Baumann <maniac@xxxxxxxxxxxxxxxxxxx>
+- * Sam Spilsbury <smspillaz@xxxxxxxxx>
+- *
+- *
+- * This program is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU General Public License
+- * as published by the Free Software Foundation; either version 2
+- * of the License, or (at your option) any later version.
+- *
+- * This program is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- * GNU General Public License for more details.
+- *
+- **/
+-
+-#ifndef _EXPO_GLOW_H
+-#define _EXPO_GLOW_H
+-
+-#define GLOWQUAD_TOPLEFT 0
+-#define GLOWQUAD_TOPRIGHT 1
+-#define GLOWQUAD_BOTTOMLEFT 2
+-#define GLOWQUAD_BOTTOMRIGHT 3
+-#define GLOWQUAD_TOP 4
+-#define GLOWQUAD_BOTTOM 5
+-#define GLOWQUAD_LEFT 6
+-#define GLOWQUAD_RIGHT 7
+-#define NUM_GLOWQUADS 8
+-
+-/* Represents a particular glow texture, so here
+- * we have hardcoded in the texture data, the offset
+- * and the size of the texture
+- */
+-
+-typedef struct _GlowTextureProperties {
+- char *textureData;
+- int textureSize;
+- int glowOffset;
+-} GlowTextureProperties;
+-
+-/* Each glow quad contains a 2x2 scale + positional matrix
+- * (the 3rd column is not used since that is for matrix skew
+- * operations which we do not care about)
+- * and also a CompRect which describes the size and position of
+- * the quad on the glow
+- */
+-
+-class GlowQuad {
+- public:
+- CompRect mBox;
+- GLTexture::Matrix mMatrix;
+-};
+-
+-extern const GlowTextureProperties glowTextureProperties;
+-
+-#endif
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/grid/grid.xml.in compiz-plugins-main-gles2/grid/grid.xml.in
+--- compiz-plugins-main-package/grid/grid.xml.in 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/grid/grid.xml.in 2012-04-05 12:29:41.374453000 +0200
+@@ -23,16 +23,17 @@
+ <option name="put_center_key" type="key">
+ <_short>Put Center</_short>
+ <_long>Move window to the center</_long>
++ <default><Control><Alt>KP_5</default>
+ </option>
+ <option name="put_left_key" type="key">
+ <_short>Put Left</_short>
+ <_long>Move window to the left edge</_long>
+- <default><Control><Super>Left</default>
++ <default><Control><Alt>KP_4</default>
+ </option>
+ <option name="put_right_key" type="key">
+ <_short>Put Right</_short>
+ <_long>Move window to the right edge</_long>
+- <default><Control><Super>Right</default>
++ <default><Control><Alt>KP_6</default>
+ </option>
+ <option name="put_top_key" type="key">
+ <_short>Put Top</_short>
+@@ -67,6 +68,7 @@
+ <option name="put_maximize_key" type="key">
+ <_short>Maximize</_short>
+ <_long>Maximize window</_long>
++ <default><Control><Alt>KP_0</default>
+ </option>
+ <option name="put_restore_key" type="key">
+ <_short>Restore</_short>
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/grid/src/grid.cpp compiz-plugins-main-gles2/grid/src/grid.cpp
+--- compiz-plugins-main-package/grid/src/grid.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/grid/src/grid.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -429,22 +429,23 @@
+ const GLMatrix &transform,
+ CompOutput *output)
+ {
+- CompRect rect;
+- GLMatrix sTransform (transform);
+- std::vector<Animation>::iterator iter;
++ CompRect rect;
++ GLMatrix sTransform (transform);
++ std::vector<Animation>::iterator iter;
++ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
++ GLfloat vertexData[12];
++ GLushort colorData[4];
++ GLushort *color;
++ GLboolean isBlendingEnabled;
+
+ getPaintRectangle (rect);
+
+ for (unsigned int i = 0; i < animations.size (); i++)
+ setCurrentRect (animations.at (i));
+
+- glPushMatrix ();
+-
+ sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
+
+- glLoadMatrixf (sTransform.getMatrix ());
+-
+- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
++ glGetBooleanv (GL_BLEND, &isBlendingEnabled);
+ glEnable (GL_BLEND);
+
+ for (iter = animations.begin (); iter != animations.end () && animating; iter++)
+@@ -452,38 +453,64 @@
+ Animation& anim = *iter;
+ float alpha = ((float) optionGetFillColorAlpha () / 65535.0f) * anim.opacity;
+
+- /* fill rectangle */
+- glColor4f (((float) optionGetFillColorRed () / 65535.0f) * alpha,
+- ((float) optionGetFillColorGreen () / 65535.0f) * alpha,
+- ((float) optionGetFillColorBlue () / 65535.0f) * alpha,
+- alpha);
+-
+- /* fill rectangle */
+- glRecti (anim.currentRect.x1 (), anim.currentRect.y2 (),
+- anim.currentRect.x2 (), anim.currentRect.y1 ());
+-
+- /* Set outline rect smaller to avoid damage issues */
+- anim.currentRect.setGeometry (anim.currentRect.x () + 1,
+- anim.currentRect.y () + 1,
+- anim.currentRect.width () - 2,
+- anim.currentRect.height () - 2);
+-
+- alpha = (float) (optionGetOutlineColorAlpha () / 65535.0f) * anim.opacity;
++ color = optionGetFillColor ();
++ colorData[0] = alpha * color[0];
++ colorData[1] = alpha * color[1];
++ colorData[2] = alpha * color[2];
++ colorData[3] = alpha * 65535.0f;
++
++ vertexData[0] = anim.currentRect.x1 ();
++ vertexData[1] = anim.currentRect.y1 ();
++ vertexData[2] = 0.0f;
++ vertexData[3] = anim.currentRect.x1 ();
++ vertexData[4] = anim.currentRect.y2 ();
++ vertexData[5] = 0.0f;
++ vertexData[6] = anim.currentRect.x2 ();
++ vertexData[7] = anim.currentRect.y1 ();
++ vertexData[8] = 0.0f;
++ vertexData[9] = anim.currentRect.x2 ();
++ vertexData[10] = anim.currentRect.y2 ();
++ vertexData[11] = 0.0f;
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (sTransform);
++
++ /* Set outline rect smaller to avoid damage issues */
++ anim.currentRect.setGeometry (anim.currentRect.x () + 1,
++ anim.currentRect.y () + 1,
++ anim.currentRect.width () - 2,
++ anim.currentRect.height () - 2);
++
++ alpha = ((float) optionGetOutlineColorAlpha () / 65535.0f) * anim.opacity;
++
++ /* draw outline */
++ color = optionGetOutlineColor ();
++ colorData[0] = alpha * color[0];
++ colorData[1] = alpha * color[1];
++ colorData[2] = alpha * color[2];
++ colorData[3] = alpha * 65535.0f;
++
++ vertexData[0] = anim.currentRect.x1 ();
++ vertexData[1] = anim.currentRect.y1 ();
++ vertexData[3] = anim.currentRect.x1 ();
++ vertexData[4] = anim.currentRect.y2 ();
++ vertexData[6] = anim.currentRect.x2 ();
++ vertexData[7] = anim.currentRect.y2 ();
++ vertexData[9] = anim.currentRect.x2 ();
++ vertexData[10] = anim.currentRect.y1 ();
++
++ glLineWidth (2.0);
++
++ streamingBuffer->begin (GL_LINE_LOOP);
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addVertices (4, vertexData);
+
+- /* draw outline */
+- glColor4f (((float) optionGetOutlineColorRed () / 65535.0f) * alpha,
+- ((float) optionGetOutlineColorGreen () / 65535.0f) * alpha,
+- ((float) optionGetOutlineColorBlue () / 65535.0f) * alpha,
+- alpha);
+-
+- glLineWidth (2.0);
+-
+- glBegin (GL_LINE_LOOP);
+- glVertex2i (anim.currentRect.x1 (), anim.currentRect.y1 ());
+- glVertex2i (anim.currentRect.x2 (), anim.currentRect.y1 ());
+- glVertex2i (anim.currentRect.x2 (), anim.currentRect.y2 ());
+- glVertex2i (anim.currentRect.x1 (), anim.currentRect.y2 ());
+- glEnd ();
++ streamingBuffer->end ();
++ streamingBuffer->render (sTransform);
+ }
+
+ if (!animating)
+@@ -491,12 +518,28 @@
+ /* fill rectangle */
+ float alpha = (float) optionGetFillColorAlpha () / 65535.0f;
+
+- /* fill rectangle */
+- glColor4f (((float) optionGetFillColorRed () / 65535.0f) * alpha,
+- ((float) optionGetFillColorGreen () / 65535.0f) * alpha,
+- ((float) optionGetFillColorBlue () / 65535.0f) * alpha,
+- alpha);
+- glRecti (rect.x1 (), rect.y2 (), rect.x2 (), rect.y1 ());
++ color = optionGetFillColor ();
++ colorData[0] = alpha * color[0];
++ colorData[1] = alpha * color[1];
++ colorData[2] = alpha * color[2];
++ colorData[3] = alpha * 65535.0f;
++
++ vertexData[0] = rect.x1 ();
++ vertexData[1] = rect.y1 ();
++ vertexData[2] = 0.0f;
++ vertexData[3] = rect.x1 ();
++ vertexData[4] = rect.y2 ();
++ vertexData[5] = 0.0f;
++ vertexData[6] = rect.x2 ();
++ vertexData[7] = rect.y1 ();
++ vertexData[8] = 0.0f;
++ vertexData[9] = rect.x2 ();
++ vertexData[10] = rect.y2 ();
++ vertexData[11] = 0.0f;
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addVertices (4, vertexData);
+
+ /* Set outline rect smaller to avoid damage issues */
+ rect.setGeometry (rect.x () + 1, rect.y () + 1,
+@@ -505,26 +548,34 @@
+ /* draw outline */
+ alpha = (float) optionGetOutlineColorAlpha () / 65535.0f;
+
++ color = optionGetOutlineColor ();
++ colorData[0] = alpha * color[0];
++ colorData[1] = alpha * color[1];
++ colorData[2] = alpha * color[2];
++ colorData[3] = alpha * 65535.0f;
++
+ /* draw outline */
+- glColor4f (((float) optionGetOutlineColorRed () / 65535.0f) * alpha,
+- ((float) optionGetOutlineColorGreen () / 65535.0f) * alpha,
+- ((float) optionGetOutlineColorBlue () / 65535.0f) * alpha,
+- alpha);
++ vertexData[0] = rect.x1 ();
++ vertexData[1] = rect.y1 ();
++ vertexData[3] = rect.x1 ();
++ vertexData[4] = rect.y2 ();
++ vertexData[6] = rect.x2 ();
++ vertexData[7] = rect.y2 ();
++ vertexData[9] = rect.x2 ();
++ vertexData[10] = rect.y1 ();
+
+ glLineWidth (2.0);
+- glBegin (GL_LINE_LOOP);
+- glVertex2i (rect.x1 (), rect.y1 ());
+- glVertex2i (rect.x2 (), rect.y1 ());
+- glVertex2i (rect.x2 (), rect.y2 ());
+- glVertex2i (rect.x1 (), rect.y2 ());
+- glEnd ();
++
++ streamingBuffer->begin (GL_LINE_LOOP);
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (sTransform);
+ }
+
+- /* clean up */
+- glColor4usv (defaultColor);
+- glDisable (GL_BLEND);
+- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
+- glPopMatrix ();
++ if (!isBlendingEnabled)
++ glDisable (GL_BLEND);
+ }
+
+ bool
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/group_glow.h compiz-plugins-main-gles2/group_glow.h
+--- compiz-plugins-main-package/group_glow.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/group_glow.h 1970-01-01 01:00:00.000000000 +0100
+@@ -1,197 +0,0 @@
+-#ifndef _GROUP_GLOWTEX_H
+-#define _GROUP_GLOWTEX_H
+-
+-/**
+- *
+- * Compiz group plugin
+- *
+- * group_glow.h
+- *
+- * Copyright : (C) 2006-2010 by Patrick Niklaus, Roi Cohen,
+- * Danny Baumann, Sam Spilsbury
+- * Authors: Patrick Niklaus <patrick.niklaus@xxxxxxxxxxxxxx>
+- * Roi Cohen <roico.beryl@xxxxxxxxx>
+- * Danny Baumann <maniac@xxxxxxxxxxxxxxxxxxx>
+- * Sam Spilsbury <smspillaz@xxxxxxxxx>
+- *
+- *
+- * This program is free software; you can redistribute it and/or
+- * modify it under the terms of the GNU General Public License
+- * as published by the Free Software Foundation; either version 2
+- * of the License, or (at your option) any later version.
+- *
+- * This program is distributed in the hope that it will be useful,
+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+- * GNU General Public License for more details.
+- *
+- **/
+-
+-/*
+- * glowTex
+- */
+-
+-static char glowTexRect[4097] = {
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377"
+- "\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377"
+- "\377\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\6\377\377"
+- "\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377"
+- "\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\6"
+- "\377\377\377\14\377\377\377\14\377\377\377\14\377\377\377\14\377\377\377"
+- "\14\377\377\377\14\377\377\377\14\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\6\377\377\377\14"
+- "\377\377\377\14\377\377\377\22\377\377\377\22\377\377\377\22\377\377\377"
+- "\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377"
+- "\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377\27\377\377\377"
+- "\35\377\377\377\35\377\377\377\35\377\377\377\35\377\377\377\35\377\377\377"
+- "\35\377\377\377\35\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377"
+- "\377\6\377\377\377\6\377\377\377\14\377\377\377\22\377\377\377\27\377\377"
+- "\377\27\377\377\377\35\377\377\377#\377\377\377'\377\377\377'\377\377\377"
+- "+\377\377\377+\377\377\377+\377\377\377+\377\377\377+\377\377\377+\377\377"
+- "\377+\377\377\377+\377\377\377+\377\377\3771\377\377\3771\377\377\3771\377"
+- "\377\3771\377\377\3771\377\377\3771\377\377\3771\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\22\377\377\377"
+- "\27\377\377\377\35\377\377\377#\377\377\377+\377\377\3771\377\377\3776\377"
+- "\377\377<\377\377\377>\377\377\377C\377\377\377I\377\377\377I\377\377\377"
+- "I\377\377\377I\377\377\377I\377\377\377I\377\377\377I\377\377\377I\377\377"
+- "\377L\377\377\377L\377\377\377L\377\377\377L\377\377\377L\377\377\377L\377"
+- "\377\377L\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377"
+- "\377\377\22\377\377\377\27\377\377\377#\377\377\377+\377\377\3776\377\377"
+- "\377C\377\377\377L\377\377\377U\377\377\377]\377\377\377`\377\377\377d\377"
+- "\377\377h\377\377\377k\377\377\377k\377\377\377k\377\377\377k\377\377\377"
+- "k\377\377\377k\377\377\377k\377\377\377p\377\377\377p\377\377\377p\377\377"
+- "\377p\377\377\377p\377\377\377p\377\377\377p\0\0\0\0\0\0\0\0\0\0\0\0\377"
+- "\377\377\6\377\377\377\14\377\377\377\22\314\314\314\35\377\377\377'\377"
+- "\377\3771\377\377\377>\357\357\357P\377\377\377]\363\363\363k\365\365\365"
+- "v\365\365\365|\377\377\377\202\367\367\367\210\367\367\367\214\367\367\367"
+- "\216\367\367\367\221\367\367\367\221\367\367\367\221\367\367\367\221\367"
+- "\367\367\221\367\367\367\221\367\367\367\224\367\367\367\224\367\367\367"
+- "\224\367\367\367\224\367\367\367\224\367\367\367\224\367\367\367\224\0\0"
+- "\0\0\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\22\377\377\377\27\377"
+- "\377\377'\377\377\3776\377\377\377I\377\377\377Y\377\377\377k\376\376\376"
+- "y\377\377\377\210\377\377\377\224\377\377\377\235\377\377\377\245\377\377"
+- "\377\253\377\377\377\255\377\377\377\262\377\377\377\262\377\377\377\263"
+- "\377\377\377\263\377\377\377\263\377\377\377\263\377\377\377\263\377\377"
+- "\377\266\377\377\377\266\377\377\377\266\377\377\377\266\377\377\377\266"
+- "\377\377\377\266\377\377\377\266\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377"
+- "\14\377\377\377\27\377\377\377#\377\377\3771\377\377\377I\377\377\377]\377"
+- "\377\377r\377\377\377\205\377\377\377\231\377\377\377\247\377\377\377\263"
+- "\377\377\377\275\377\377\377\304\377\377\377\310\377\377\377\313\377\377"
+- "\377\316\377\377\377\320\377\377\377\320\377\377\377\320\377\377\377\320"
+- "\377\377\377\320\377\377\377\320\377\377\377\322\377\377\377\322\377\377"
+- "\377\322\377\377\377\322\377\377\377\322\377\377\377\322\377\377\377\322"
+- "\0\0\0\0\377\377\377\6\377\377\377\6\377\377\377\22\377\377\377\35\377\377"
+- "\377+\377\377\377>\377\377\377Y\377\377\377r\377\377\377\210\376\376\376"
+- "\237\377\377\377\262\377\377\377\302\377\377\377\313\377\377\377\324\377"
+- "\377\377\332\376\376\376\336\377\377\377\341\377\377\377\342\377\377\377"
+- "\344\377\377\377\344\377\377\377\344\377\377\377\344\377\377\377\344\377"
+- "\377\377\344\377\377\377\345\377\377\377\345\377\377\377\345\377\377\377"
+- "\345\377\377\377\345\377\377\377\345\377\377\377\345\0\0\0\0\377\377\377"
+- "\6\377\377\377\14\377\377\377\27\377\377\377#\377\377\3776\377\377\377P\377"
+- "\377\377k\377\377\377\205\376\376\376\237\372\372\372\266\377\377\377\307"
+- "\373\373\373\325\373\373\373\337\374\374\374\345\374\374\374\352\374\374"
+- "\374\355\374\374\374\357\374\374\374\360\374\374\374\361\374\374\374\361"
+- "\374\374\374\362\374\374\374\362\374\374\374\362\374\374\374\362\374\374"
+- "\374\362\374\374\374\362\374\374\374\362\374\374\374\362\374\374\374\362"
+- "\374\374\374\362\374\374\374\362\0\0\0\0\377\377\377\6\377\377\377\14\377"
+- "\377\377\35\377\377\377+\377\377\377C\377\377\377]\377\377\377|\377\377\377"
+- "\231\377\377\377\263\377\377\377\307\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377"
+- "\377\377\6\377\377\377\22\324\324\324#\377\377\3771\377\377\377L\363\363"
+- "\363k\377\377\377\210\377\377\377\247\377\377\377\302\377\377\377\325\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\22\377\377"
+- "\377#\377\377\377<\377\377\377U\377\377\377v\377\377\377\226\377\377\377"
+- "\263\377\377\377\315\377\377\377\337\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377"
+- "\6\377\377\377\14\377\377\377\27\377\377\377'\377\377\377>\377\377\377]\377"
+- "\377\377|\370\370\370\237\377\377\377\275\373\373\373\325\377\377\377\345"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\27\377"
+- "\377\377+\377\377\377C\377\377\377`\377\377\377\202\377\377\377\247\377\377"
+- "\377\304\377\377\377\332\377\377\377\352\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377"
+- "\377\6\377\377\377\14\377\377\377\27\377\377\377+\377\377\377C\377\377\377"
+- "d\377\377\377\210\377\377\377\253\377\377\377\310\376\376\376\336\374\374"
+- "\374\355\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377"
+- "\35\377\377\377+\377\377\377I\377\377\377h\377\377\377\214\377\377\377\260"
+- "\377\377\377\313\374\374\374\342\374\374\374\357\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\377\377\377\6\377\377\377\14\377\377\377\35\342\342\3421\377\377\377I\377"
+- "\377\377k\377\377\377\216\377\377\377\262\377\377\377\316\374\374\374\344"
+- "\377\377\377\360\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377"
+- "\377\377\35\377\377\3771\377\377\377L\377\377\377k\377\377\377\221\377\377"
+- "\377\263\377\377\377\320\377\377\377\344\377\377\377\361\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377"
+- "\377L\377\377\377k\377\377\377\221\377\377\377\263\377\377\377\320\377\377"
+- "\377\344\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377"
+- "\14\377\377\377\35\377\377\3771\377\377\377L\364\364\364p\377\377\377\221"
+- "\372\372\372\266\377\377\377\320\374\374\374\345\377\377\377\362\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\377"
+- "1\377\377\377L\377\377\377p\377\377\377\221\377\377\377\266\373\373\373\322"
+- "\377\377\377\345\377\377\377\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377"
+- "\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377p\377\377"
+- "\377\221\377\377\377\266\373\373\373\322\377\377\377\345\377\377\377\362"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377"
+- "\377\3771\377\377\377L\377\377\377p\377\377\377\221\377\377\377\266\373\373"
+- "\373\322\377\377\377\345\377\377\377\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377"
+- "\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377"
+- "p\367\367\367\224\377\377\377\266\377\377\377\322\377\377\377\345\374\374"
+- "\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377"
+- "\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224\377\377\377\266"
+- "\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377\377L\377"
+- "\377\377p\367\367\367\224\377\377\377\266\377\377\377\322\377\377\377\345"
+- "\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377"
+- "\377\377\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224\377\377"
+- "\377\266\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\3771\377\377"
+- "\377L\377\377\377p\367\367\367\224\377\377\377\266\377\377\377\322\377\377"
+- "\377\345\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377"
+- "\14\377\377\377\35\377\377\3771\377\377\377L\377\377\377p\367\367\367\224"
+- "\377\377\377\266\377\377\377\322\377\377\377\345\374\374\374\362\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\377\377\377\6\377\377\377\14\377\377\377\35\377\377\377"
+- "1\377\377\377L\377\377\377p\367\367\367\224\377\377\377\266\377\377\377\322"
+- "\377\377\377\345\374\374\374\362\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
+- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0",
+-};
+-
+-#endif
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/kdecompat/src/kdecompat.cpp compiz-plugins-main-gles2/kdecompat/src/kdecompat.cpp
+--- compiz-plugins-main-package/kdecompat/src/kdecompat.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/kdecompat/src/kdecompat.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -204,7 +204,6 @@
+
+ if (mSlideData && mSlideData->remaining)
+ {
+- GLFragment::Attrib fragment (gWindow->paintAttrib ());
+ GLMatrix wTransform = transform;
+ SlideData *data = mSlideData;
+ float xTranslate = 0, yTranslate = 0, remainder;
+@@ -241,26 +240,20 @@
+ status = gWindow->glPaint (attrib, transform, region, mask |
+ PAINT_WINDOW_NO_CORE_INSTANCE_MASK);
+
+- if (window->alpha () || fragment.getOpacity () != OPAQUE)
++ if (window->alpha () || attrib.opacity != OPAQUE)
+ mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
+
+ wTransform.translate (xTranslate, yTranslate, 0.0f);
+
+- glPushMatrix ();
+- glLoadMatrixf (wTransform.getMatrix ());
+-
+- glPushAttrib (GL_SCISSOR_BIT);
+ glEnable (GL_SCISSOR_TEST);
+
+ glScissor (clipBox.x1 (), screen->height () - clipBox.y2 (),
+ clipBox.width (), clipBox.height ());
+
+- status = gWindow->glDraw (wTransform, fragment, region,
++ status = gWindow->glDraw (wTransform, attrib, region,
+ mask | PAINT_WINDOW_TRANSFORMED_MASK);
+
+ glDisable (GL_SCISSOR_TEST);
+- glPopAttrib ();
+- glPopMatrix ();
+ }
+
+ foreach (const Thumb& thumb, mPreviews)
+@@ -329,20 +322,17 @@
+ matrices[0].x0 -= (tw->x () * icon->matrix ().xx);
+ matrices[0].y0 -= (tw->y () * icon->matrix ().yy);
+
+- gtw->geometry ().reset ();
++ gtw->vertexBuffer ()->begin ();
+ gtw->glAddGeometry (matrices, tw->geometry (), infiniteRegion);
+-
+- if (!gtw->geometry ().vertices)
+- icon = NULL;
++ gtw->vertexBuffer ()->end ();
+ }
+ }
+
+ if (!gtw->textures ().empty () || icon)
+ {
+- GLFragment::Attrib fragment (attrib);
+ GLMatrix wTransform (transform);
+
+- if (tw->alpha () || fragment.getOpacity () != OPAQUE)
++ if (tw->alpha () || attrib.opacity != OPAQUE)
+ paintMask |= PAINT_WINDOW_TRANSLUCENT_MASK;
+
+ wTransform.translate (tw->x (), tw->y (), 0.0f);
+@@ -351,16 +341,11 @@
+ yTranslate / yScale - tw->y (),
+ 0.0f);
+
+- glPushMatrix ();
+- glLoadMatrixf (wTransform.getMatrix ());
+-
+ if (!gtw->textures ().empty ())
+- gtw->glDraw (wTransform, fragment,
++ gtw->glDraw (wTransform, attrib,
+ infiniteRegion, paintMask);
+ else if (icon)
+- gtw->glDrawTexture (icon, fragment, paintMask);
+-
+- glPopMatrix ();
++ gtw->glDrawTexture (icon, wTransform, attrib, paintMask);
+ }
+ }
+
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/mag/CMakeLists.txt compiz-plugins-main-gles2/mag/CMakeLists.txt
+--- compiz-plugins-main-package/mag/CMakeLists.txt 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/mag/CMakeLists.txt 2012-04-05 12:29:41.374453000 +0200
+@@ -2,4 +2,4 @@
+
+ include (CompizPlugin)
+
+-compiz_plugin (mag PLUGINDEPS composite opengl mousepoll)
++#compiz_plugin (mag PLUGINDEPS composite opengl mousepoll)
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/neg/src/neg.cpp compiz-plugins-main-gles2/neg/src/neg.cpp
+--- compiz-plugins-main-package/neg/src/neg.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/neg/src/neg.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -22,7 +22,12 @@
+
+ #include "neg.h"
+
+-using namespace GLFragment;
++static std::string fragment_function = " \n\
++void neg_fragment () { \n\
++ vec3 color = vec3(1.0, 1.0, 1.0) - gl_FragColor.rgb; \n\
++ gl_FragColor = vec4(color, gl_FragColor.a); \n\
++} \n\
++";
+
+ COMPIZ_PLUGIN_20090315 (neg, NegPluginVTable);
+
+@@ -74,63 +79,11 @@
+ return true;
+ }
+
+-int
+-NegScreen::getFragmentFunction (GLTexture *texture,
+- bool alpha)
+-{
+- int handle = 0;
+-
+- if (alpha && negAlphaFunction)
+- handle = negAlphaFunction;
+- else if (!alpha && negFunction)
+- handle = negFunction;
+-
+- if (!handle)
+- {
+- FunctionData data;
+- int target;
+-
+- if (alpha)
+- data.addTempHeaderOp ("neg");
+-
+- if (texture->target () == GL_TEXTURE_2D)
+- target = COMP_FETCH_TARGET_2D;
+- else
+- target = COMP_FETCH_TARGET_RECT;
+-
+- data.addFetchOp ("output", NULL, target);
+-
+- if (alpha)
+- {
+- data.addDataOp ("RCP neg.a, output.a;");
+- data.addDataOp ("MAD output.rgb, -neg.a, output, 1.0;");
+- }
+- else
+- data.addDataOp ("SUB output.rgb, 1.0, output;");
+-
+- if (alpha)
+- data.addDataOp ("MUL output.rgb, output.a, output;");
+-
+- data.addColorOp ("output", "output");
+-
+- if (!data.status ())
+- return 0;
+-
+- handle = data.createFragmentFunction ("neg");
+-
+- if (alpha)
+- negAlphaFunction = handle;
+- else
+- negFunction = handle;
+- }
+-
+- return handle;
+-}
+-
+ void
+-NegWindow::glDrawTexture (GLTexture *texture,
+- GLFragment::Attrib &attrib,
+- unsigned int mask)
++NegWindow::glDrawTexture (GLTexture *texture,
++ const GLMatrix &transform,
++ const GLWindowPaintAttrib &attrib,
++ unsigned int mask)
+ {
+ GLTexture::Filter filter;
+ bool doNeg = false;
+@@ -160,24 +113,15 @@
+
+ if (doNeg && tex)
+ {
+- /* Fragment program negation */
+- if (GL::fragmentProgram)
++ /* shader program negation */
++ if (true)
+ {
+- GLFragment::Attrib fa = attrib;
+- int function;
+- bool alpha = true;
+-
+- if (texture->name () == tex->name ()) /* Not a decoration */
+- alpha = window->alpha ();
+-
+- function = ns->getFragmentFunction (texture, alpha);
+- if (function)
+- fa.addFunction (function);
+-
+- gWindow->glDrawTexture (texture, fa, mask);
++ gWindow->addShaders ("neg", "", fragment_function);
++ gWindow->glDrawTexture (texture, transform, attrib, mask);
+ }
+ else /* Texture manipulation negation */
+ {
++#ifndef USE_GLES
+ /* this is for the most part taken from paint.c */
+
+ if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
+@@ -188,14 +132,10 @@
+ filter = ns->gScreen->filter (NOTHING_TRANS_FILTER);
+
+ /* if we can adjust saturation, even if it's just on and off */
+- if (GL::canDoSaturated && attrib.getSaturation () != COLOR)
++ if (GL::canDoSaturated && attrib.saturation != COLOR)
+ {
+ GLfloat constant[4];
+
+- /* if the paint mask has this set we want to blend */
+- if (mask & PAINT_WINDOW_TRANSLUCENT_MASK)
+- glEnable (GL_BLEND);
+-
+ /* enable the texture */
+ texture->enable (filter);
+
+@@ -233,7 +173,7 @@
+ glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
+
+ /* if we can do saturation that is in between min and max */
+- if (GL::canDoSlightlySaturated && attrib.getSaturation () > 0)
++ if (GL::canDoSlightlySaturated && attrib.saturation > 0)
+ {
+ glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
+ glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
+@@ -270,13 +210,13 @@
+ glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
+
+ /* color constant */
+- constant[3] = attrib.getSaturation () / 65535.0f;
++ constant[3] = attrib.saturation / 65535.0f;
+
+ glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
+
+ /* if we are not opaque or not fully bright */
+- if (attrib.getOpacity () < OPAQUE ||
+- attrib.getBrightness () != BRIGHT)
++ if (attrib.opacity < OPAQUE ||
++ attrib.brightness != BRIGHT)
+ {
+ /* make another texture active */
+ GL::activeTexture (GL_TEXTURE3_ARB);
+@@ -285,9 +225,9 @@
+ texture->enable (filter);
+
+ /* color constant */
+- constant[3] = attrib.getOpacity () / 65535.0f;
++ constant[3] = attrib.opacity / 65535.0f;
+ constant[0] = constant[1] = constant[2] =
+- constant[3] * attrib.getBrightness () / 65535.0f;
++ constant[3] * attrib.brightness / 65535.0f;
+
+ glTexEnvfv(GL_TEXTURE_ENV,
+ GL_TEXTURE_ENV_COLOR, constant);
+@@ -314,8 +254,7 @@
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
+
+- /* draw the window geometry */
+- gWindow->glDrawGeometry ();
++ gWindow->glDrawTexture (texture, transform, attrib, mask);
+
+ /* disable the current texture */
+ texture->disable ();
+@@ -331,8 +270,7 @@
+ {
+ /* fully opaque and bright */
+
+- /* draw the window geometry */
+- gWindow->glDrawGeometry ();
++ gWindow->glDrawTexture (texture, transform, attrib, mask);
+ }
+
+ /* disable the current texture */
+@@ -355,9 +293,9 @@
+ glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
+
+ /* color constant */
+- constant[3] = attrib.getOpacity () / 65535.0f;
++ constant[3] = attrib.opacity / 65535.0f;
+ constant[0] = constant[1] = constant[2] =
+- constant[3] * attrib.getBrightness () / 65535.0f;
++ constant[3] * attrib.brightness / 65535.0f;
+
+ constant[0] =
+ 0.5f + 0.5f * RED_SATURATION_WEIGHT * constant[0];
+@@ -368,8 +306,7 @@
+
+ glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
+
+- /* draw the window geometry */
+- gWindow->glDrawGeometry ();
++ gWindow->glDrawTexture (texture, transform, attrib, mask);
+ }
+
+ /* disable the current texture */
+@@ -390,9 +327,6 @@
+ /* set screens texture mode back to replace */
+ ns->gScreen->setTexEnvMode (GL_REPLACE);
+
+- /* if it's a translucent window, disable blending */
+- if (mask & PAINT_WINDOW_TRANSLUCENT_MASK)
+- glDisable (GL_BLEND);
+ }
+ else
+ {
+@@ -411,17 +345,14 @@
+
+ /* we are not opaque or fully bright */
+ if ((mask & PAINT_WINDOW_TRANSLUCENT_MASK) ||
+- attrib.getBrightness () != BRIGHT)
++ attrib.brightness != BRIGHT)
+ {
+ GLfloat constant[4];
+
+- /* enable blending */
+- glEnable (GL_BLEND);
+-
+ /* color constant */
+- constant[3] = attrib.getOpacity () / 65535.0f;
++ constant[3] = attrib.opacity / 65535.0f;
+ constant[0] = constant[1] = constant[2] =
+- constant[3] * attrib.getBrightness () / 65535.0f;
++ constant[3] * attrib.brightness / 65535.0f;
+
+ glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
+ glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
+@@ -441,18 +372,13 @@
+ glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
+ glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
+
+- /* draw the window geometry */
+- gWindow->glDrawGeometry ();
+-
+- /* disable blending */
+- glDisable (GL_BLEND);
++ gWindow->glDrawTexture (texture, transform, attrib, mask);
+ }
+ else
+ {
+ /* no adjustments to saturation, brightness or opacity */
+
+- /* draw the window geometry */
+- gWindow->glDrawGeometry ();
++ gWindow->glDrawTexture (texture, transform, attrib, mask);
+ }
+
+ /* disable the current texture */
+@@ -461,12 +387,13 @@
+ /* set the screens texture mode back to replace */
+ ns->gScreen->setTexEnvMode (GL_REPLACE);
+ }
++#endif
+ }
+ }
+ else
+ {
+ /* not negative */
+- gWindow->glDrawTexture (texture, attrib, mask);
++ gWindow->glDrawTexture (texture, transform, attrib, mask);
+ }
+ }
+
+@@ -524,7 +451,7 @@
+ _1, _2));
+ optionSetExcludeMatchNotify (boost::bind (&NegScreen::optionChanged, this,
+ _1, _2));
+- optionSetNegDecorationsNotify (boost::bind (&NegScreen::optionChanged, this,
++ optionSetNegDecorationsNotify (boost::bind (&NegScreen::optionChanged, this,
+ _1, _2));
+
+ }
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/neg/src/neg.h compiz-plugins-main-gles2/neg/src/neg.h
+--- compiz-plugins-main-package/neg/src/neg.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/neg/src/neg.h 2012-04-05 12:29:41.374453000 +0200
+@@ -57,10 +57,6 @@
+ CompOption::Vector opt,
+ bool all);
+
+- int
+- getFragmentFunction (GLTexture *texture,
+- bool alpha);
+-
+ GLScreen *gScreen;
+ };
+
+@@ -89,9 +85,10 @@
+ bool isNeg;
+
+ void
+- glDrawTexture(GLTexture *texture,
+- GLFragment::Attrib &attrib,
+- unsigned int mask);
++ glDrawTexture (GLTexture *texture,
++ const GLMatrix &transform,
++ const GLWindowPaintAttrib &attrib,
++ unsigned int mask);
+
+ void toggle ();
+ };
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/resizeinfo/src/resizeinfo.cpp compiz-plugins-main-gles2/resizeinfo/src/resizeinfo.cpp
+--- compiz-plugins-main-package/resizeinfo/src/resizeinfo.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/resizeinfo/src/resizeinfo.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -349,8 +349,9 @@
+ /* Draw a texture at x/y on a quad of RESIZE_POPUP_WIDTH /
+ RESIZE_POPUP_HEIGHT with the opacity in InfoScreen. */
+ void
+-InfoLayer::draw (int x,
+- int y)
++InfoLayer::draw (const GLMatrix &transform,
++ int x,
++ int y)
+ {
+ BOX box;
+ float opacity;
+@@ -362,9 +363,12 @@
+
+ for (unsigned int i = 0; i < texture.size (); i++)
+ {
+-
++ GLushort colorData[4];
++ GLfloat textureData[8];
++ GLfloat vertexData[12];
+ GLTexture *tex = texture[i];
+- GLTexture::Matrix matrix = tex->matrix ();
++ GLTexture::Matrix matrix = tex->matrix ();
++ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
+
+ tex->enable (GLTexture::Good);
+
+@@ -380,22 +384,41 @@
+ if (is->drawing)
+ opacity = 1.0f - opacity;
+
+- glColor4f (opacity, opacity, opacity, opacity);
+- glBegin (GL_QUADS);
+- glTexCoord2f (COMP_TEX_COORD_X (matrix, box.x1),
+- COMP_TEX_COORD_Y (matrix, box.y2));
+- glVertex2i (box.x1, box.y2);
+- glTexCoord2f (COMP_TEX_COORD_X (matrix, box.x2),
+- COMP_TEX_COORD_Y (matrix, box.y2));
+- glVertex2i (box.x2, box.y2);
+- glTexCoord2f (COMP_TEX_COORD_X (matrix, box.x2),
+- COMP_TEX_COORD_Y (matrix, box.y1));
+- glVertex2i (box.x2, box.y1);
+- glTexCoord2f (COMP_TEX_COORD_X (matrix, box.x1),
+- COMP_TEX_COORD_Y (matrix, box.y1));
+- glVertex2i (box.x1, box.y1);
+- glEnd ();
+- glColor4usv (defaultColor);
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ colorData[0] = opacity * 65536;
++ colorData[1] = opacity * 65536;
++ colorData[2] = opacity * 65536;
++ colorData[3] = opacity * 65536;
++
++ textureData[0] = COMP_TEX_COORD_X (matrix, box.x1);
++ textureData[1] = COMP_TEX_COORD_Y (matrix, box.y2);
++ textureData[2] = COMP_TEX_COORD_X (matrix, box.x2);
++ textureData[3] = COMP_TEX_COORD_Y (matrix, box.y2);
++ textureData[4] = COMP_TEX_COORD_X (matrix, box.x1);
++ textureData[5] = COMP_TEX_COORD_Y (matrix, box.y1);
++ textureData[6] = COMP_TEX_COORD_X (matrix, box.x2);
++ textureData[7] = COMP_TEX_COORD_Y (matrix, box.y1);
++
++ vertexData[0] = box.x1;
++ vertexData[1] = box.y2;
++ vertexData[2] = 0;
++ vertexData[3] = box.x2;
++ vertexData[4] = box.y2;
++ vertexData[5] = 0;
++ vertexData[6] = box.x1;
++ vertexData[7] = box.y1;
++ vertexData[8] = 0;
++ vertexData[9] = box.x2;
++ vertexData[10] = box.y1;
++ vertexData[11] = 0;
++
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addTexCoords (0, 4, textureData);
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (transform);
+
+ tex->disable ();
+ }
+@@ -424,21 +447,8 @@
+
+ sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
+
+- glPushMatrix ();
+- glLoadMatrixf (sTransform.getMatrix ());
+-
+- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
+- glEnable (GL_BLEND);
+- gScreen->setTexEnvMode (GL_MODULATE);
+-
+- backgroundLayer.draw (x, y);
+- textLayer.draw (x, y);
+-
+- gScreen->setTexEnvMode (GL_REPLACE);
+- glDisable (GL_BLEND);
+- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
+-
+- glPopMatrix ();
++ backgroundLayer.draw (sTransform, x, y);
++ textLayer.draw (sTransform, x, y);
+ }
+
+ return status;
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/resizeinfo/src/resizeinfo.h compiz-plugins-main-gles2/resizeinfo/src/resizeinfo.h
+--- compiz-plugins-main-package/resizeinfo/src/resizeinfo.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/resizeinfo/src/resizeinfo.h 2012-04-05 12:29:41.374453000 +0200
+@@ -57,8 +57,9 @@
+ GLTexture::List texture;
+ cairo_t *cr;
+
+- void draw (int x,
+- int y);
++ void draw (const GLMatrix &transform,
++ int x,
++ int y);
+
+ void renderBackground ();
+ void renderText ();
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/ring/src/ring.cpp compiz-plugins-main-gles2/ring/src/ring.cpp
+--- compiz-plugins-main-package/ring/src/ring.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/ring/src/ring.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -177,10 +177,11 @@
+ }
+
+ void
+-RingScreen::drawWindowTitle ()
++RingScreen::drawWindowTitle (const GLMatrix &transform)
+ {
+ if (!textAvailable)
+ return;
++
+ float x, y;
+ CompRect oe;
+
+@@ -211,7 +212,7 @@
+ break;
+ }
+
+- mText.draw (floor (x), floor (y), 1.0f);
++ mText.draw (transform, floor (x), floor (y), 1.0f);
+ }
+
+ bool
+@@ -256,23 +257,23 @@
+
+ if (scaled && pixmap)
+ {
+- GLFragment::Attrib fragment (gWindow->lastPaintAttrib ());
+- GLMatrix wTransform = transform;
++ GLWindowPaintAttrib wAttrib (gWindow->lastPaintAttrib ());
++ GLMatrix wTransform = transform;
+
+ if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK)
+ return false;
+
+ if (mSlot)
+ {
+- fragment.setBrightness((float) fragment.getBrightness () *
+- mSlot->depthBrightness);
++ wAttrib.brightness = (float)wAttrib.brightness *
++ mSlot->depthBrightness;
+
+ if (window != rs->mSelectedWindow)
+- fragment.setOpacity ((float)fragment.getOpacity () *
+- rs->optionGetInactiveOpacity () / 100);
++ wAttrib.opacity = (float)wAttrib.opacity *
++ rs->optionGetInactiveOpacity () / 100;
+ }
+
+- if (window->alpha () || fragment.getOpacity () != OPAQUE)
++ if (window->alpha () || wAttrib.opacity != OPAQUE)
+ mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
+
+ wTransform.translate (window->x (), window->y (), 0.0f);
+@@ -281,13 +282,8 @@
+ mTy / mScale - window->y (),
+ 0.0f);
+
+- glPushMatrix ();
+- glLoadMatrixf (wTransform.getMatrix ());
+-
+- gWindow->glDraw (wTransform, fragment, region,
++ gWindow->glDraw (wTransform, wAttrib, region,
+ mask | PAINT_WINDOW_TRANSFORMED_MASK);
+-
+- glPopMatrix ();
+ }
+
+ if (scaled && (rs->mState != RingScreen::RingStateIn) &&
+@@ -375,38 +371,27 @@
+
+ matricies.push_back (matrix);
+
+- gWindow->geometry ().reset ();
+-
++ gWindow->vertexBuffer ()->begin ();
+ gWindow->glAddGeometry (matricies, iconReg, iconReg);
++ gWindow->vertexBuffer ()->end ();
+
+- if (gWindow->geometry ().vCount)
+- {
+- GLFragment::Attrib fragment (sAttrib);
+- GLMatrix wTransform = transform;
+-
+- if (!pixmap)
+- sAttrib.opacity = gWindow->paintAttrib ().opacity;
+-
+- if (mSlot)
+- fragment.setBrightness (
+- (float) fragment.getBrightness () *
+- mSlot->depthBrightness);
+-
+- wTransform.translate (window->x (), window->y (), 0.0f);
+- wTransform.scale (scale, scale, 1.0f);
+- wTransform.translate ((x - window->x ()) / scale -
+- window->x (),
+- (y - window->y ()) / scale -
+- window->y (),
+- 0.0f);
++ GLWindowPaintAttrib wAttrib (sAttrib);
++ GLMatrix wTransform = transform;
+
+- glPushMatrix ();
+- glLoadMatrixf (wTransform.getMatrix ());
++ if (!pixmap)
++ sAttrib.opacity = gWindow->paintAttrib ().opacity;
+
+- gWindow->glDrawTexture (icon, fragment, mask);
++ if (mSlot)
++ wAttrib.brightness = (float)wAttrib.brightness *
++ mSlot->depthBrightness;
++
++ wTransform.translate (window->x (), window->y (), 0.0f);
++ wTransform.scale (scale, scale, 1.0f);
++ wTransform.translate ((x - window->x ()) / scale - window->x (),
++ (y - window->y ()) / scale - window->y (),
++ 0.0f);
+
+- glPopMatrix ();
+- }
++ gWindow->glDrawTexture (icon, wTransform, wAttrib, mask);
+ }
+ }
+ }
+@@ -775,8 +760,6 @@
+ GLMatrix sTransform = transform;
+
+ sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
+- glPushMatrix ();
+- glLoadMatrixf (sTransform.getMatrix ());
+
+ /* TODO: This code here should be reworked */
+
+@@ -796,9 +779,7 @@
+ }
+
+ if (mState != RingStateIn)
+- drawWindowTitle ();
+-
+- glPopMatrix ();
++ drawWindowTitle (sTransform);
+ }
+
+ return status;
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/ring/src/ring.h compiz-plugins-main-gles2/ring/src/ring.h
+--- compiz-plugins-main-package/ring/src/ring.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/ring/src/ring.h 2012-04-05 12:29:41.374453000 +0200
+@@ -144,7 +144,7 @@
+ renderWindowTitle ();
+
+ void
+- drawWindowTitle ();
++ drawWindowTitle (const GLMatrix &transform);
+
+ bool
+ layoutThumbs ();
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/scaleaddon/src/scaleaddon.cpp compiz-plugins-main-gles2/scaleaddon/src/scaleaddon.cpp
+--- compiz-plugins-main-package/scaleaddon/src/scaleaddon.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/scaleaddon/src/scaleaddon.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -91,7 +91,7 @@
+ }
+
+ void
+-ScaleAddonWindow::drawTitle ()
++ScaleAddonWindow::drawTitle (const GLMatrix &transform)
+ {
+ float x, y, width, height;
+ ScalePosition pos = sWindow->getCurrentPosition ();
+@@ -103,14 +103,16 @@
+ x = pos.x () + window->x () + geom.width () * pos.scale / 2 - width / 2;
+ y = pos.y () + window->y () + geom.height () * pos.scale / 2 - height / 2;
+
+- text.draw (floor (x), floor (y), 1.0f);
++ text.draw (transform, floor (x), floor (y), 1.0f);
+ }
+
+ void
+-ScaleAddonWindow::drawHighlight ()
++ScaleAddonWindow::drawHighlight (const GLMatrix &transform)
+ {
+- GLboolean wasBlend;
+- GLint oldBlendSrc, oldBlendDst;
++ GLint oldBlendSrc, oldBlendDst, oldBlendSrcAlpha, oldBlendDstAlpha;
++ GLushort colorData[4];
++ GLfloat vertexData[12];
++ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
+ float x, y, width, height;
+ ScalePosition pos = sWindow->getCurrentPosition ();
+ CompRect geom = window->borderRect ();
+@@ -130,27 +132,51 @@
+ x = floor (x + 0.5f);
+ y = floor (y + 0.5f);
+
+- wasBlend = glIsEnabled (GL_BLEND);
++#ifdef USE_GLES
++ glGetIntegerv (GL_BLEND_SRC_RGB, &oldBlendSrc);
++ glGetIntegerv (GL_BLEND_DST_RGB, &oldBlendDst);
++ glGetIntegerv (GL_BLEND_SRC_ALPHA, &oldBlendSrcAlpha);
++ glGetIntegerv (GL_BLEND_DST_ALPHA, &oldBlendDstAlpha);
++#else
+ glGetIntegerv (GL_BLEND_SRC, &oldBlendSrc);
+ glGetIntegerv (GL_BLEND_DST, &oldBlendDst);
+-
+- if (!wasBlend)
+- glEnable (GL_BLEND);
++#endif
+
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+- glColor4us (as->optionGetHighlightColorRed (),
+- as->optionGetHighlightColorGreen (),
+- as->optionGetHighlightColorBlue (),
+- as->optionGetHighlightColorAlpha ());
+-
+- glRectf (x, y + height, x + width, y);
+-
+- glColor4usv (defaultColor);
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
+
+- if (!wasBlend)
+- glDisable (GL_BLEND);
++ colorData[0] = as->optionGetHighlightColorRed ();
++ colorData[1] = as->optionGetHighlightColorGreen ();
++ colorData[2] = as->optionGetHighlightColorBlue ();
++ colorData[3] = as->optionGetHighlightColorAlpha ();
++
++ streamingBuffer->addColors (1, colorData);
++
++ vertexData[0] = x;
++ vertexData[1] = y;
++ vertexData[2] = 0.0f;
++ vertexData[3] = x;
++ vertexData[4] = y + height;
++ vertexData[5] = 0.0f;
++ vertexData[6] = x + width;
++ vertexData[7] = y;
++ vertexData[8] = 0.0f;
++ vertexData[9] = x + width;
++ vertexData[10] = y + height;
++ vertexData[11] = 0.0f;
++
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (transform);
++
++#ifdef USE_GLES
++ glBlendFuncSeparate (oldBlendSrc, oldBlendDst,
++ oldBlendSrcAlpha, oldBlendDstAlpha);
++#else
+ glBlendFunc (oldBlendSrc, oldBlendDst);
++#endif
+ }
+
+ void
+@@ -415,11 +441,11 @@
+ if (as->optionGetWindowHighlight ())
+ {
+ if (window->id () == as->highlightedWindow)
+- drawHighlight ();
++ drawHighlight (transform);
+ }
+
+ if (textAvailable)
+- drawTitle ();
++ drawTitle (transform);
+ }
+ }
+
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/scaleaddon/src/scaleaddon.h compiz-plugins-main-gles2/scaleaddon/src/scaleaddon.h
+--- compiz-plugins-main-package/scaleaddon/src/scaleaddon.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/scaleaddon/src/scaleaddon.h 2012-04-05 12:29:41.374453000 +0200
+@@ -141,10 +141,10 @@
+ renderTitle ();
+
+ void
+- drawTitle ();
++ drawTitle (const GLMatrix &transform);
+
+ void
+- drawHighlight ();
++ drawHighlight (const GLMatrix &transform);
+ };
+
+ #define ADDON_WINDOW(w) \
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/shift/src/shift.cpp compiz-plugins-main-gles2/shift/src/shift.cpp
+--- compiz-plugins-main-package/shift/src/shift.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/shift/src/shift.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -183,7 +183,7 @@
+ }
+
+ void
+-ShiftScreen::drawWindowTitle ()
++ShiftScreen::drawWindowTitle (const GLMatrix &transform)
+ {
+ float width, height, border = 10.0f;
+ CompRect oe;
+@@ -225,16 +225,16 @@
+ return;
+ }
+
+- text.draw (floor (x), floor (y), 1.0f);
++ text.draw (transform, floor (x), floor (y), 1.0f);
+ }
+
+ bool
+ ShiftWindow::glPaint (const GLWindowPaintAttrib &attrib,
+- const GLMatrix &transform,
+- const CompRegion ®ion,
+- unsigned int mask)
++ const GLMatrix &transform,
++ const CompRegion ®ion,
++ unsigned int mask)
+ {
+- bool status;
++ bool status;
+
+ SHIFT_SCREEN (screen);
+ if (ss->mState != ShiftStateNone && !ss->mPaintingAbove &&
+@@ -272,9 +272,9 @@
+
+ if (scaled && !gWindow->textures ().empty ())
+ {
+- GLFragment::Attrib fragment (attrib);
+- GLMatrix wTransform = transform;
+- ShiftSlot *slot = ss->mActiveSlot->slot;
++ GLWindowPaintAttrib wAttrib (attrib);
++ GLMatrix wTransform = transform;
++ ShiftSlot *slot = ss->mActiveSlot->slot;
+
+ float sx = ss->mAnim * slot->tx;
+ float sy = ss->mAnim * slot->ty;
+@@ -302,11 +302,11 @@
+ /*if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK)
+ return false;*/
+
+- fragment.setOpacity ((float)fragment.getOpacity () * sopacity);
+- fragment.setBrightness ((float)fragment.getBrightness () *
+- ss->mReflectBrightness);
++ wAttrib.opacity = (float)wAttrib.opacity * sopacity;
++ wAttrib.brightness = (float)wAttrib.brightness *
++ ss->mReflectBrightness;
+
+- if (window->alpha () || fragment.getOpacity () != OPAQUE)
++ if (window->alpha () || wAttrib.opacity != OPAQUE)
+ mask |= PAINT_WINDOW_TRANSLUCENT_MASK;
+
+ wTransform.translate (sx, sy, sz);
+@@ -327,13 +327,8 @@
+ wTransform.translate (-window->x () - (window->width () / 2),
+ -window->y () - (window->height () / 2), 0.0f);
+
+- glPushMatrix ();
+- glLoadMatrixf (wTransform.getMatrix ());
+-
+- gWindow->glDraw (wTransform, fragment, region,
++ gWindow->glDraw (wTransform, wAttrib, region,
+ mask | PAINT_WINDOW_TRANSFORMED_MASK);
+-
+- glPopMatrix ();
+ }
+
+ if (scaled && ((ss->optionGetOverlayIcon () != ShiftOptions::OverlayIconNone) ||
+@@ -418,53 +413,50 @@
+
+ iconReg = CompRegion (0, 0, icon->width (), icon->height ());
+
+- gWindow->geometry ().reset ();
++ gWindow->vertexBuffer ()->begin ();
+
+ matl.push_back (icon->matrix ());
+
+ gWindow->glAddGeometry (matl, iconReg, iconReg);
+
+- if (gWindow->geometry ().vCount)
+- {
+- GLFragment::Attrib fragment (sAttrib);
+- GLMatrix wTransform (transform);
++ gWindow->vertexBuffer ()->end ();
+
+- if (gWindow->textures ().empty ())
+- sAttrib.opacity = gWindow->paintAttrib ().opacity;
++ GLWindowPaintAttrib wAttrib (sAttrib);
++ GLMatrix wTransform (transform);
+
+- fragment = GLFragment::Attrib (sAttrib);
+-
+- fragment.setOpacity ((float)fragment.getOpacity () * sopacity);
+- fragment.setBrightness ((float)fragment.getBrightness () *
+- ss->mReflectBrightness);
++ if (gWindow->textures ().empty ())
++ sAttrib.opacity = gWindow->paintAttrib ().opacity;
+
+- wTransform.translate (sx, sy, sz);
++ wAttrib = GLWindowPaintAttrib (sAttrib);
+
+- wTransform.translate (window->x () +
+- (window->width () * sscale / 2),
+- window->y () +
+- (window->height () * sscale / 2.0), 0.0f);
++ wAttrib.opacity = (float)wAttrib.opacity * sopacity;
++ wAttrib.brightness = (float)wAttrib.brightness *
++ ss->mReflectBrightness;
+
+- wTransform.scale (ss->mOutput->width (),
+- -ss->mOutput->height (), 1.0f);
++ wTransform.translate (sx, sy, sz);
+
+- wTransform.rotate (srot, 0.0, 1.0, 0.0);
++ wTransform.translate (window->x () +
++ (window->width () * sscale / 2),
++ window->y () +
++ (window->height () * sscale / 2.0),
++ 0.0f);
+
+- wTransform.scale (1.0f / ss->mOutput->width (),
+- -1.0f / ss->mOutput->height (), 1.0f);
++ wTransform.scale (ss->mOutput->width (),
++ -ss->mOutput->height (),
++ 1.0f);
+
+- wTransform.translate (x -
+- (window->width () * sscale / 2), y -
+- (window->height () * sscale / 2.0), 0.0f);
+- wTransform.scale (scale, scale, 1.0f);
++ wTransform.rotate (srot, 0.0, 1.0, 0.0);
+
+- glPushMatrix ();
+- glLoadMatrixf (wTransform.getMatrix ());
++ wTransform.scale (1.0f / ss->mOutput->width (),
++ -1.0f / ss->mOutput->height (),
++ 1.0f);
+
+- gWindow->glDrawTexture (icon, fragment, mask);
++ wTransform.translate (x - (window->width () * sscale / 2),
++ y - (window->height () * sscale / 2.0),
++ 0.0f);
++ wTransform.scale (scale, scale, 1.0f);
+
+- glPopMatrix ();
+- }
++ gWindow->glDrawTexture (icon, wTransform, wAttrib, mask);
+ }
+ }
+
+@@ -1153,39 +1145,28 @@
+
+ sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
+
+- GLdouble clip[4] = { 0.0, -1.0, 0.0, 0.0};
+-
+- clip[3] = ((oy1 + (oy2 - oy1) / 2)) + (maxThumbHeight / 2.0);
+-
+ /* Reflection drawing */
+
+ if (optionGetReflection ())
+ {
+- GLMatrix rTransform = sTransform;
+- unsigned short color[4];
+- int cull, cullInv;
++ GLMatrix rTransform = sTransform;
++ GLMatrix r2Transform;
++ GLushort colorData[4];
++ GLfloat vertexData[12];
++ int cull, cullInv;
++ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
++
+ glGetIntegerv (GL_CULL_FACE_MODE, &cull);
+ cullInv = (cull == GL_BACK)? GL_FRONT : GL_BACK;
+
+- rTransform.translate (0.0, oy1 + oy2 + maxThumbHeight,
+- 0.0);
++ rTransform.translate (0.0, oy1 + oy2 + maxThumbHeight, 0.0);
+ rTransform.scale (1.0, -1.0, 1.0);
+
+- glPushMatrix ();
+- glLoadMatrixf (rTransform.getMatrix ());
+-
+ glCullFace (cullInv);
+
+ if (optionGetMipmaps ())
+ gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);
+
+-
+- if (mAnim == 1.0)
+- {
+- glClipPlane (GL_CLIP_PLANE0, clip);
+- glEnable (GL_CLIP_PLANE0);
+- }
+-
+ mReflectActive = true;
+ mReflectBrightness = optionGetIntensity ();
+ for (i = 0; i < mNSlots; i++)
+@@ -1201,63 +1182,81 @@
+ }
+ }
+
+- glDisable (GL_CLIP_PLANE0);
+ glCullFace (cull);
++ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
++ r2Transform.translate (0.0, 0.0, -DEFAULT_Z_CAMERA);
+
+- glLoadIdentity();
+- glTranslatef (0.0, 0.0, -DEFAULT_Z_CAMERA);
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
+
+- glEnable(GL_BLEND);
+- glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
++ colorData[0] = 0;
++ colorData[1] = 0;
++ colorData[2] = 0;
++ colorData[3] = 0;
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addColors (1, colorData);
++
++ colorData[3] = MIN (1.0,
++ 1.0 - optionGetIntensity ()) * 2.0 * mAnim;
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addColors (1, colorData);
++
++ vertexData[0] = 0.5;
++ vertexData[1] = 0;
++ vertexData[2] = 0;
++ vertexData[3] = -0.5;
++ vertexData[4] = 0;
++ vertexData[5] = 0;
++ vertexData[6] = 0.5;
++ vertexData[7] = -0.5;
++ vertexData[8] = 0;
++ vertexData[9] = -0.5;
++ vertexData[10] = -0.5;
++ vertexData[11] = 0;
++
++ streamingBuffer->addVertices (4, vertexData);
+
+- glBegin (GL_QUADS);
+- glColor4f (0.0, 0.0, 0.0, 0.0);
+- glVertex2f (0.5, 0.0);
+- glVertex2f (-0.5, 0.0);
+- glColor4f (0.0, 0.0, 0.0,
+- MIN (1.0, 1.0 - optionGetIntensity ()) * 2.0 *
+- mAnim);
+- glVertex2f (-0.5, -0.5);
+- glVertex2f (0.5, -0.5);
+- glEnd();
++ streamingBuffer->end ();
++ streamingBuffer->render (r2Transform);
+
+ if (optionGetGroundSize () > 0.0)
+ {
+- glBegin (GL_QUADS);
+- color[0] = optionGetGroundColor1 ()[0];
+- color[1] = optionGetGroundColor1 ()[1];
+- color[2] = optionGetGroundColor1 ()[2];
+- color[3] = (float)optionGetGroundColor1 ()[3] * mAnim;
+- glColor4usv (color);
+- glVertex2f (-0.5, -0.5);
+- glVertex2f (0.5, -0.5);
+- color[0] = optionGetGroundColor2 ()[0];
+- color[1] = optionGetGroundColor2 ()[1];
+- color[2] = optionGetGroundColor2 ()[2];
+- color[3] = (float)optionGetGroundColor2 ()[3] * mAnim;
+- glColor4usv (color);
+- glVertex2f (0.5, -0.5 + optionGetGroundSize ());
+- glVertex2f (-0.5, -0.5 + optionGetGroundSize ());
+- glEnd();
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ colorData[0] = optionGetGroundColor1 ()[0];
++ colorData[1] = optionGetGroundColor1 ()[1];
++ colorData[2] = optionGetGroundColor1 ()[2];
++ colorData[3] = (float)optionGetGroundColor1 ()[3] * mAnim;
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addColors (1, colorData);
++
++ colorData[3] = (float)optionGetGroundColor2 ()[3] * mAnim;
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addColors (1, colorData);
++
++ vertexData[0] = -0.5;
++ vertexData[1] = -0.5;
++ vertexData[2] = 0;
++ vertexData[3] = 0.5;
++ vertexData[4] = -0.5;
++ vertexData[5] = 0;
++ vertexData[6] = -0.5;
++ vertexData[7] = -0.5 + optionGetGroundSize ();
++ vertexData[8] = 0;
++ vertexData[9] = 0.5;
++ vertexData[10] = -0.5 + optionGetGroundSize ();
++ vertexData[11] = 0;
++
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (r2Transform);
+ }
+
+ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+- glDisable(GL_BLEND);
+- glColor4f (1.0, 1.0, 1.0, 1.0);
+- glPopMatrix ();
+ }
+
+ /* Drawing normal windows */
+
+- glPushMatrix ();
+- glLoadMatrixf (sTransform.getMatrix ());
+-
+- if (optionGetReflection () && mAnim == 1.0)
+- {
+- glClipPlane (GL_CLIP_PLANE0, clip);
+- glEnable (GL_CLIP_PLANE0);
+- }
+-
+ mReflectBrightness = 1.0;
+ mReflectActive = false;
+
+@@ -1274,14 +1273,12 @@
+ }
+ }
+
+- glDisable (GL_CLIP_PLANE0);
+-
+ mActiveSlot = NULL;
+
+ gScreen->setTextureFilter (oldFilter);
+
+ if (textAvailable && (mState != ShiftStateIn))
+- drawWindowTitle ();
++ drawWindowTitle (sTransform);
+
+ if (mState == ShiftStateIn || mState == ShiftStateOut)
+ {
+@@ -1316,8 +1313,6 @@
+
+ mPaintingAbove = false;
+ }
+-
+- glPopMatrix ();
+ }
+
+ return status;
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/shift/src/shift.h compiz-plugins-main-gles2/shift/src/shift.h
+--- compiz-plugins-main-package/shift/src/shift.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/shift/src/shift.h 2012-04-05 12:29:41.374453000 +0200
+@@ -188,7 +188,7 @@
+ renderWindowTitle ();
+
+ void
+- drawWindowTitle ();
++ drawWindowTitle (const GLMatrix &transform);
+
+ bool
+ layoutThumbsCover ();
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/staticswitcher/src/staticswitcher.cpp compiz-plugins-main-gles2/staticswitcher/src/staticswitcher.cpp
+--- compiz-plugins-main-package/staticswitcher/src/staticswitcher.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/staticswitcher/src/staticswitcher.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -793,18 +793,34 @@
+ }
+
+ void
+-StaticSwitchScreen::paintRect (CompRect &box,
+- int offset,
+- unsigned short *color,
+- int opacity)
++StaticSwitchScreen::paintRect (const GLMatrix &transform,
++ CompRect &box,
++ int offset,
++ unsigned short *color,
++ int opacity)
+ {
+- glColor4us (color[0], color[1], color[2], color[3] * opacity / 100);
+- glBegin (GL_LINE_LOOP);
+- glVertex2i (box.x1 () + offset, box.y1 () + offset);
+- glVertex2i (box.x2 () - offset, box.y1 () + offset);
+- glVertex2i (box.x2 () - offset, box.y2 () - offset);
+- glVertex2i (box.x1 () + offset, box.y2 () - offset);
+- glEnd ();
++ GLushort colorData[4] = {
++ color[0],
++ color[1],
++ color[2],
++ color[3] * opacity / 100
++ };
++
++ GLfloat vertexData[12] = {
++ box.x1 () + offset, box.y1 () + offset, 0,
++ box.x2 () - offset, box.y1 () + offset, 0,
++ box.x2 () - offset, box.y2 () - offset, 0,
++ box.x1 () + offset, box.y2 () - offset, 0
++ };
++
++ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
++ streamingBuffer->begin (GL_LINE_LOOP);
++
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (transform);
+ }
+
+ bool
+@@ -874,9 +890,6 @@
+
+ sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
+
+- glPushMatrix ();
+- glLoadMatrixf (sTransform.getMatrix ());
+-
+ if (mode == HighlightModeShowRectangle)
+ {
+ CompWindow *w;
+@@ -891,33 +904,44 @@
+ if (getPaintRectangle (w, box, &opacity))
+ {
+ unsigned short *color;
+- GLushort r, g, b, a;
+-
+- glEnable (GL_BLEND);
++ GLushort colorData[4];
++ GLfloat vertexData[12];
++ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
+
+ /* fill rectangle */
+- r = optionGetHighlightColorRed ();
+- g = optionGetHighlightColorGreen ();
+- b = optionGetHighlightColorBlue ();
+- a = optionGetHighlightColorAlpha ();
+- a = a * opacity / 100;
+-
+- glColor4us (r, g, b, a);
+- glRecti (box.x1 (), box.y2 (), box.x2 (), box.y1 ());
++ colorData[0] = optionGetHighlightColorRed ();
++ colorData[1] = optionGetHighlightColorGreen ();
++ colorData[2] = optionGetHighlightColorBlue ();
++ colorData[3] = optionGetHighlightColorAlpha ();
++ colorData[3] = colorData[3] * opacity / 100;
++
++ vertexData[0] = box.x1 ();
++ vertexData[1] = box.y2 ();
++ vertexData[2] = 0.0f;
++ vertexData[3] = box.x1 ();
++ vertexData[4] = box.y1 ();
++ vertexData[5] = 0.0f;
++ vertexData[6] = box.x2 ();
++ vertexData[7] = box.y2 ();
++ vertexData[8] = 0.0f;
++ vertexData[9] = box.x2 ();
++ vertexData[10] = box.y1 ();
++ vertexData[11] = 0.0f;
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addVertices (4, vertexData);
++ streamingBuffer->end ();
++ streamingBuffer->render (sTransform);
+
+ /* draw outline */
+ glLineWidth (1.0);
+- glDisable (GL_LINE_SMOOTH);
+
+ color = optionGetHighlightBorderColor ();
+- paintRect (box, 0, color, opacity);
+- paintRect (box, 2, color, opacity);
++ paintRect (sTransform, box, 0, color, opacity);
++ paintRect (sTransform, box, 2, color, opacity);
+ color = optionGetHighlightBorderInlayColor ();
+- paintRect (box, 1, color, opacity);
+-
+- /* clean up */
+- glColor4usv (defaultColor);
+- glDisable (GL_BLEND);
++ paintRect (sTransform, box, 1, color, opacity);
+ }
+ }
+ }
+@@ -934,8 +958,6 @@
+ sTransform, infiniteRegion, 0);
+ }
+ }
+-
+- glPopMatrix ();
+ }
+ }
+ else
+@@ -978,21 +1000,24 @@
+ }
+
+ void
+-StaticSwitchScreen::paintSelectionRect (int x,
+- int y,
+- float dx,
+- float dy,
+- unsigned int opacity)
++StaticSwitchScreen::paintSelectionRect (const GLMatrix &transform,
++ int x,
++ int y,
++ float dx,
++ float dy,
++ unsigned int opacity)
+ {
+- float color[4], op;
++ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
++ GLushort colorData[4];
++ GLfloat vertexData[18];
++ GLMatrix sTransform (transform);
++ float op;
+ int w, h;
+ int count = windows.size ();
+
+ w = previewWidth + previewBorder;
+ h = previewHeight + previewBorder;
+
+- glEnable (GL_BLEND);
+-
+ if (dx > xCount - 1)
+ op = 1.0 - MIN (1.0, dx - (xCount - 1));
+ else if (dx + (dy * xCount) > count - 1)
+@@ -1003,35 +1028,97 @@
+ op = 1.0;
+
+ for (unsigned int i = 0; i < 4; i++)
+- color[i] = (float)fgColor[i] * opacity * op / 0xffffffff;
++ colorData[i] = (float)fgColor[i] * opacity * op / 0xffffffff;
++
++ sTransform.translate (x + previewBorder / 2 + (dx * w),
++ y + previewBorder / 2 + (dy * h), 0.0f);
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
+
+- glColor4fv (color);
+- glPushMatrix ();
+- glTranslatef (x + previewBorder / 2 + (dx * w),
+- y + previewBorder / 2 + (dy * h), 0.0f);
+-
+- glBegin (GL_QUADS);
+- glVertex2i (-1, -1);
+- glVertex2i (-1, 1);
+- glVertex2i (w + 1, 1);
+- glVertex2i (w + 1, -1);
+- glVertex2i (-1, h - 1);
+- glVertex2i (-1, h + 1);
+- glVertex2i (w + 1, h + 1);
+- glVertex2i (w + 1, h - 1);
+- glVertex2i (-1, 1);
+- glVertex2i (-1, h - 1);
+- glVertex2i (1, h - 1);
+- glVertex2i (1, 1);
+- glVertex2i (w - 1, 1);
+- glVertex2i (w - 1, h - 1);
+- glVertex2i (w + 1, h - 1);
+- glVertex2i (w + 1, 1);
+- glEnd ();
+-
+- glPopMatrix ();
+- glColor4usv (defaultColor);
+- glDisable (GL_BLEND);
++ vertexData[0] = -1;
++ vertexData[1] = -1;
++ vertexData[2] = 0;
++ vertexData[3] = -1;
++ vertexData[4] = 1;
++ vertexData[5] = 0;
++ vertexData[6] = w + 1;
++ vertexData[7] = -1;
++ vertexData[8] = 0;
++ vertexData[9] = w + 1;
++ vertexData[10] = 1;
++ vertexData[11] = 0;
++
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (sTransform);
++
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ vertexData[0] = -1;
++ vertexData[1] = h - 1;
++ vertexData[2] = 0;
++ vertexData[3] = -1;
++ vertexData[4] = h + 1;
++ vertexData[5] = 0;
++ vertexData[6] = w + 1;
++ vertexData[7] = h - 1;
++ vertexData[8] = 0;
++ vertexData[9] = w + 1;
++ vertexData[10] = h + 1;
++ vertexData[11] = 0;
++
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (sTransform);
++
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ vertexData[0] = -1;
++ vertexData[1] = 1;
++ vertexData[2] = 0;
++ vertexData[3] = -1;
++ vertexData[4] = h - 1;
++ vertexData[5] = 0;
++ vertexData[6] = 1;
++ vertexData[7] = 1;
++ vertexData[8] = 0;
++ vertexData[9] = 1;
++ vertexData[10] = h - 1;
++ vertexData[11] = 0;
++
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (sTransform);
++
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ vertexData[0] = w - 1;
++ vertexData[1] = 1;
++ vertexData[2] = 0;
++ vertexData[3] = w - 1;
++ vertexData[4] = h - 1;
++ vertexData[5] = 0;
++ vertexData[6] = w + 1;
++ vertexData[7] = 1;
++ vertexData[8] = 0;
++ vertexData[9] = w + 1;
++ vertexData[10] = h - 1;
++ vertexData[11] = 0;
++
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (sTransform);
+ }
+
+ bool
+@@ -1157,8 +1244,6 @@
+ if (!(mask & PAINT_WINDOW_TRANSFORMED_MASK) && region.isEmpty ())
+ return true;
+
+- glPushAttrib (GL_SCISSOR_BIT);
+-
+ glEnable (GL_SCISSOR_TEST);
+ glScissor (g.x (), 0, g.width (), ::screen->height ());
+
+@@ -1181,34 +1266,33 @@
+ if (pos > count - 1)
+ {
+ px = fmod (pos - count, sScreen->xCount);
+- sScreen->paintSelectionRect (g.x (), g.y (), px, 0.0,
++ sScreen->paintSelectionRect (transform, g.x (), g.y (), px, 0.0,
+ gWindow->lastPaintAttrib ().opacity);
+
+ px = fmod (pos, sScreen->xCount);
+- sScreen->paintSelectionRect (g.x () + offX, g.y (),
++ sScreen->paintSelectionRect (transform, g.x () + offX, g.y (),
+ px, py,
+ gWindow->lastPaintAttrib ().opacity);
+ }
+ if (px > sScreen->xCount - 1)
+ {
+- sScreen->paintSelectionRect (g.x (), g.y (), px, py,
++ sScreen->paintSelectionRect (transform, g.x (), g.y (), px, py,
+ gWindow->lastPaintAttrib ().opacity);
+
+ py = fmod (py + 1, ceil ((double) count / sScreen->xCount));
+ offX = sScreen->getRowXOffset (py);
+
+- sScreen->paintSelectionRect (g.x () + offX, g.y (),
++ sScreen->paintSelectionRect (transform, g.x () + offX, g.y (),
+ px - sScreen->xCount, py,
+ gWindow->lastPaintAttrib ().opacity);
+ }
+ else
+ {
+- sScreen->paintSelectionRect (g.x () + offX, g.y (),
++ sScreen->paintSelectionRect (transform, g.x () + offX, g.y (),
+ px, py,
+ gWindow->lastPaintAttrib ().opacity);
+ }
+ glDisable (GL_SCISSOR_TEST);
+- glPopAttrib ();
+ }
+ /* Adjust opacity/brightness/saturation of windows that are
+ * not selected
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/staticswitcher/src/staticswitcher.h compiz-plugins-main-gles2/staticswitcher/src/staticswitcher.h
+--- compiz-plugins-main-package/staticswitcher/src/staticswitcher.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/staticswitcher/src/staticswitcher.h 2012-04-05 12:29:41.374453000 +0200
+@@ -78,15 +78,17 @@
+ int y);
+ void handleEvent (XEvent *event);
+ bool adjustVelocity ();
+- void paintRect (CompRect &box,
+- int offset,
+- unsigned short *color,
+- int opacity);
+- void paintSelectionRect (int x,
+- int y,
+- float dx,
+- float dy,
+- unsigned int opacity);
++ void paintRect (const GLMatrix &transform,
++ CompRect &box,
++ int offset,
++ unsigned short *color,
++ int opacity);
++ void paintSelectionRect (const GLMatrix &transform,
++ int x,
++ int y,
++ float dx,
++ float dy,
++ unsigned int opacity);
+ void getMinimizedAndMatch (bool &minimizedOption,
+ CompMatch *&match);
+ bool getMipmap ();
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/text/include/text/text.h compiz-plugins-main-gles2/text/include/text/text.h
+--- compiz-plugins-main-package/text/include/text/text.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/text/include/text/text.h 2012-04-05 12:29:41.374453000 +0200
+@@ -77,9 +77,10 @@
+ int getWidth () const;
+ int getHeight () const;
+
+- void draw (float x,
+- float y,
+- float alpha) const;
++ void draw (const GLMatrix &transform,
++ float x,
++ float y,
++ float alpha) const;
+
+ private:
+ int width;
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/text/src/text.cpp compiz-plugins-main-gles2/text/src/text.cpp
+--- compiz-plugins-main-package/text/src/text.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/text/src/text.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -487,27 +487,37 @@
+ }
+
+ void
+-CompText::draw (float x,
+- float y,
+- float alpha) const
++CompText::draw (const GLMatrix &transform,
++ float x,
++ float y,
++ float alpha) const
+ {
+- GLboolean wasBlend;
+- GLint oldBlendSrc, oldBlendDst;
++ GLint oldBlendSrc, oldBlendDst;
++ GLint oldBlendSrcAlpha, oldBlendDstAlpha;
++ GLushort colorData[4];
++ GLfloat textureData[8];
++ GLfloat vertexData[12];
++ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
+
+ if (texture.empty ())
+ return;
+
++#ifdef USE_GLES
++ glGetIntegerv (GL_BLEND_SRC_RGB, &oldBlendSrc);
++ glGetIntegerv (GL_BLEND_DST_RGB, &oldBlendDst);
++ glGetIntegerv (GL_BLEND_SRC_ALPHA, &oldBlendSrcAlpha);
++ glGetIntegerv (GL_BLEND_DST_ALPHA, &oldBlendDstAlpha);
++#else
+ glGetIntegerv (GL_BLEND_SRC, &oldBlendSrc);
+ glGetIntegerv (GL_BLEND_DST, &oldBlendDst);
+-
+- wasBlend = glIsEnabled (GL_BLEND);
+- if (!wasBlend)
+- glEnable (GL_BLEND);
++#endif
+
+ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+
+- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+- glColor4f (alpha, alpha, alpha, alpha);
++ colorData[0] = alpha * 65536;
++ colorData[1] = alpha * 65536;
++ colorData[2] = alpha * 65536;
++ colorData[3] = alpha * 65536;
+
+ for (unsigned int i = 0; i < texture.size (); i++)
+ {
+@@ -516,27 +526,46 @@
+
+ tex->enable (GLTexture::Good);
+
+- glBegin (GL_QUADS);
+-
+- glTexCoord2f (COMP_TEX_COORD_X (m, 0), COMP_TEX_COORD_Y (m, 0));
+- glVertex2f (x, y - height);
+- glTexCoord2f (COMP_TEX_COORD_X (m, 0), COMP_TEX_COORD_Y (m, height));
+- glVertex2f (x, y);
+- glTexCoord2f (COMP_TEX_COORD_X (m, width), COMP_TEX_COORD_Y (m, height));
+- glVertex2f (x + width, y);
+- glTexCoord2f (COMP_TEX_COORD_X (m, width), COMP_TEX_COORD_Y (m, 0));
+- glVertex2f (x + width, y - height);
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
+
+- glEnd ();
++ vertexData[0] = x;
++ vertexData[1] = y - height;
++ vertexData[2] = 0;
++ vertexData[3] = x;
++ vertexData[4] = y;
++ vertexData[5] = 0;
++ vertexData[6] = x + width;
++ vertexData[7] = y - height;
++ vertexData[8] = 0;
++ vertexData[9] = x + width;
++ vertexData[10] = y;
++ vertexData[11] = 0;
++
++ textureData[0] = COMP_TEX_COORD_X (m, 0);
++ textureData[1] = COMP_TEX_COORD_Y (m, 0);
++ textureData[2] = COMP_TEX_COORD_X (m, 0);
++ textureData[3] = COMP_TEX_COORD_Y (m, height);
++ textureData[4] = COMP_TEX_COORD_X (m, width);
++ textureData[5] = COMP_TEX_COORD_Y (m, 0);
++ textureData[6] = COMP_TEX_COORD_X (m, width);
++ textureData[7] = COMP_TEX_COORD_Y (m, height);
++
++ streamingBuffer->addColors (1, colorData);
++ streamingBuffer->addVertices (4, vertexData);
++ streamingBuffer->addTexCoords (0, 4, textureData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (transform);
+
+ tex->disable ();
+ }
+
+- glColor4usv (defaultColor);
+-
+- if (!wasBlend)
+- glDisable (GL_BLEND);
++#ifdef USE_GLES
++ glBlendFuncSeparate (oldBlendSrc, oldBlendDst,
++ oldBlendSrcAlpha, oldBlendDstAlpha);
++#else
+ glBlendFunc (oldBlendSrc, oldBlendDst);
++#endif
+ }
+
+ CompText::CompText () :
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/thumbnail/CMakeLists.txt compiz-plugins-main-gles2/thumbnail/CMakeLists.txt
+--- compiz-plugins-main-package/thumbnail/CMakeLists.txt 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/thumbnail/CMakeLists.txt 2012-04-05 12:29:41.374453000 +0200
+@@ -2,4 +2,4 @@
+
+ include (CompizPlugin)
+
+-compiz_plugin (thumbnail PLUGINDEPS text mousepoll)
++compiz_plugin (thumbnail PLUGINDEPS composite opengl text mousepoll)
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/thumbnail/src/thumbnail.cpp compiz-plugins-main-gles2/thumbnail/src/thumbnail.cpp
+--- compiz-plugins-main-package/thumbnail/src/thumbnail.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/thumbnail/src/thumbnail.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -529,99 +529,305 @@
+
+
+ void
+-ThumbScreen::paintTexture (int wx,
+- int wy,
+- int width,
+- int height,
+- int off)
++ThumbScreen::paintTexture (const GLMatrix &transform,
++ GLushort *color,
++ int wx,
++ int wy,
++ int width,
++ int height,
++ int off)
+ {
+- glBegin (GL_QUADS);
++ GLfloat textureData[8];
++ GLfloat vertexData[12];
++ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ textureData[0] = 1;
++ textureData[1] = 1;
++
++ vertexData[0] = wx;
++ vertexData[1] = wy;
++ vertexData[2] = 0;
++ vertexData[3] = wx;
++ vertexData[4] = wy + height;
++ vertexData[5] = 0;
++ vertexData[6] = wx + width;
++ vertexData[7] = wy;
++ vertexData[8] = 0;
++ vertexData[9] = wx + width;
++ vertexData[10] = wy + height;
++ vertexData[11] = 0;
++
++ streamingBuffer->addTexCoords (0, 1, textureData);
++ streamingBuffer->addVertices (4, vertexData);
++ streamingBuffer->addColors (1, color);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (transform);
++
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ textureData[0] = 0;
++ textureData[1] = 0;
++ textureData[2] = 0;
++ textureData[3] = 1;
++ textureData[4] = 1;
++ textureData[5] = 0;
++ textureData[6] = 1;
++ textureData[7] = 1;
++
++ vertexData[0] = wx - off;
++ vertexData[1] = wy - off;
++ vertexData[2] = 0;
++ vertexData[3] = wx - off;
++ vertexData[4] = wy;
++ vertexData[5] = 0;
++ vertexData[6] = wx;
++ vertexData[7] = wy - off;
++ vertexData[8] = 0;
++ vertexData[9] = wx;
++ vertexData[10] = wy;
++ vertexData[11] = 0;
++
++ streamingBuffer->addTexCoords (0, 4, textureData);
++ streamingBuffer->addVertices (4, vertexData);
++ streamingBuffer->addColors (1, color);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (transform);
++
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ textureData[0] = 1;
++ textureData[1] = 0;
++ textureData[2] = 1;
++ textureData[3] = 1;
++ textureData[4] = 0;
++ textureData[5] = 0;
++ textureData[6] = 0;
++ textureData[7] = 1;
++
++ vertexData[0] = wx + width;
++ vertexData[1] = wy - off;
++ vertexData[2] = 0;
++ vertexData[3] = wx + width;
++ vertexData[4] = wy;
++ vertexData[5] = 0;
++ vertexData[6] = wx + width + off;
++ vertexData[7] = wy - off;
++ vertexData[8] = 0;
++ vertexData[9] = wx + width + off;
++ vertexData[10] = wy;
++ vertexData[11] = 0;
++
++ streamingBuffer->addTexCoords (0, 4, textureData);
++ streamingBuffer->addVertices (4, vertexData);
++ streamingBuffer->addColors (1, color);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (transform);
++
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ textureData[0] = 0;
++ textureData[1] = 1;
++ textureData[2] = 0;
++ textureData[3] = 0;
++ textureData[4] = 1;
++ textureData[5] = 1;
++ textureData[6] = 1;
++ textureData[7] = 0;
++
++ vertexData[0] = wx - off;
++ vertexData[1] = wy + height;
++ vertexData[2] = 0;
++ vertexData[3] = wx - off;
++ vertexData[4] = wy + height + off;
++ vertexData[5] = 0;
++ vertexData[6] = wx;
++ vertexData[7] = wy + height;
++ vertexData[8] = 0;
++ vertexData[9] = wx;
++ vertexData[10] = wy + height + off;
++ vertexData[11] = 0;
++
++ streamingBuffer->addTexCoords (0, 4, textureData);
++ streamingBuffer->addVertices (4, vertexData);
++ streamingBuffer->addColors (1, color);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (transform);
++
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ textureData[0] = 1;
++ textureData[1] = 1;
++ textureData[2] = 1;
++ textureData[3] = 0;
++ textureData[4] = 0;
++ textureData[5] = 1;
++ textureData[6] = 0;
++ textureData[7] = 0;
++
++ vertexData[0] = wx + width;
++ vertexData[1] = wy + height;
++ vertexData[2] = 0;
++ vertexData[3] = wx + width;
++ vertexData[4] = wy + height + off;
++ vertexData[5] = 0;
++ vertexData[6] = wx + width + off;
++ vertexData[7] = wy + height;
++ vertexData[8] = 0;
++ vertexData[9] = wx + width + off;
++ vertexData[10] = wy + height + off;
++ vertexData[11] = 0;
++
++ streamingBuffer->addTexCoords (0, 4, textureData);
++ streamingBuffer->addVertices (4, vertexData);
++ streamingBuffer->addColors (1, color);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (transform);
++
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ textureData[0] = 1;
++ textureData[1] = 0;
++ textureData[2] = 1;
++ textureData[3] = 1;
++ textureData[4] = 1;
++ textureData[5] = 0;
++ textureData[6] = 1;
++ textureData[7] = 1;
++
++ vertexData[0] = wx;
++ vertexData[1] = wy - off;
++ vertexData[2] = 0;
++ vertexData[3] = wx;
++ vertexData[4] = wy;
++ vertexData[5] = 0;
++ vertexData[6] = wx + width;
++ vertexData[7] = wy - off;
++ vertexData[8] = 0;
++ vertexData[9] = wx + width;
++ vertexData[10] = wy;
++ vertexData[11] = 0;
++
++ streamingBuffer->addTexCoords (0, 4, textureData);
++ streamingBuffer->addVertices (4, vertexData);
++ streamingBuffer->addColors (1, color);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (transform);
++
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ textureData[0] = 1;
++ textureData[1] = 1;
++ textureData[2] = 1;
++ textureData[3] = 0;
++ textureData[4] = 1;
++ textureData[5] = 1;
++ textureData[6] = 1;
++ textureData[7] = 0;
++
++ vertexData[0] = wx;
++ vertexData[1] = wy + height;
++ vertexData[2] = 0;
++ vertexData[3] = wx;
++ vertexData[4] = wy + height + off;
++ vertexData[5] = 0;
++ vertexData[6] = wx + width;
++ vertexData[7] = wy + height;
++ vertexData[8] = 0;
++ vertexData[9] = wx + width;
++ vertexData[10] = wy + height + off;
++ vertexData[11] = 0;
++
++ streamingBuffer->addTexCoords (0, 4, textureData);
++ streamingBuffer->addVertices (4, vertexData);
++ streamingBuffer->addColors (1, color);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (transform);
++
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ textureData[0] = 0;
++ textureData[1] = 1;
++ textureData[2] = 0;
++ textureData[3] = 1;
++ textureData[4] = 1;
++ textureData[5] = 1;
++ textureData[6] = 1;
++ textureData[7] = 1;
++
++ vertexData[0] = wx - off;
++ vertexData[1] = wy;
++ vertexData[2] = 0;
++ vertexData[3] = wx - off;
++ vertexData[4] = wy + height;
++ vertexData[5] = 0;
++ vertexData[6] = wx;
++ vertexData[7] = wy;
++ vertexData[8] = 0;
++ vertexData[9] = wx;
++ vertexData[10] = wy + height;
++ vertexData[11] = 0;
++
++ streamingBuffer->addTexCoords (0, 4, textureData);
++ streamingBuffer->addVertices (4, vertexData);
++ streamingBuffer->addColors (1, color);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (transform);
++
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ textureData[0] = 1;
++ textureData[1] = 1;
++ textureData[2] = 1;
++ textureData[3] = 1;
++ textureData[4] = 0;
++ textureData[5] = 1;
++ textureData[6] = 0;
++ textureData[7] = 1;
++
++ vertexData[0] = wx + width;
++ vertexData[1] = wy;
++ vertexData[2] = 0;
++ vertexData[3] = wx + width;
++ vertexData[4] = wy + height;
++ vertexData[5] = 0;
++ vertexData[6] = wx + width + off;
++ vertexData[7] = wy;
++ vertexData[8] = 0;
++ vertexData[9] = wx + width + off;
++ vertexData[10] = wy + height;
++ vertexData[11] = 0;
++
++ streamingBuffer->addTexCoords (0, 4, textureData);
++ streamingBuffer->addVertices (4, vertexData);
++ streamingBuffer->addColors (1, color);
+
+- glTexCoord2f (1, 1);
+- glVertex2f (wx, wy);
+- glVertex2f (wx, wy + height);
+- glVertex2f (wx + width, wy + height);
+- glVertex2f (wx + width, wy);
+-
+- glTexCoord2f (0, 0);
+- glVertex2f (wx - off, wy - off);
+- glTexCoord2f (0, 1);
+- glVertex2f (wx - off, wy);
+- glTexCoord2f (1, 1);
+- glVertex2f (wx, wy);
+- glTexCoord2f (1, 0);
+- glVertex2f (wx, wy - off);
+-
+- glTexCoord2f (1, 0);
+- glVertex2f (wx + width, wy - off);
+- glTexCoord2f (1, 1);
+- glVertex2f (wx + width, wy);
+- glTexCoord2f (0, 1);
+- glVertex2f (wx + width + off, wy);
+- glTexCoord2f (0, 0);
+- glVertex2f (wx + width + off, wy - off);
+-
+- glTexCoord2f (0, 1);
+- glVertex2f (wx - off, wy + height);
+- glTexCoord2f (0, 0);
+- glVertex2f (wx - off, wy + height + off);
+- glTexCoord2f (1, 0);
+- glVertex2f (wx, wy + height + off);
+- glTexCoord2f (1, 1);
+- glVertex2f (wx, wy + height);
+-
+- glTexCoord2f (1, 1);
+- glVertex2f (wx + width, wy + height);
+- glTexCoord2f (1, 0);
+- glVertex2f (wx + width, wy + height + off);
+- glTexCoord2f (0, 0);
+- glVertex2f (wx + width + off, wy + height + off);
+- glTexCoord2f (0, 1);
+- glVertex2f (wx + width + off, wy + height);
+-
+- glTexCoord2f (1, 0);
+- glVertex2f (wx, wy - off);
+- glTexCoord2f (1, 1);
+- glVertex2f (wx, wy);
+- glTexCoord2f (1, 1);
+- glVertex2f (wx + width, wy);
+- glTexCoord2f (1, 0);
+- glVertex2f (wx + width, wy - off);
+-
+- glTexCoord2f (1, 1);
+- glVertex2f (wx, wy + height);
+- glTexCoord2f (1, 0);
+- glVertex2f (wx, wy + height + off);
+- glTexCoord2f (1, 0);
+- glVertex2f (wx + width, wy + height + off);
+- glTexCoord2f (1, 1);
+- glVertex2f (wx + width, wy + height);
+-
+- glTexCoord2f (0, 1);
+- glVertex2f (wx - off, wy);
+- glTexCoord2f (0, 1);
+- glVertex2f (wx - off, wy + height);
+- glTexCoord2f (1, 1);
+- glVertex2f (wx, wy + height);
+- glTexCoord2f (1, 1);
+- glVertex2f (wx, wy);
+-
+- glTexCoord2f (1, 1);
+- glVertex2f (wx + width, wy);
+- glTexCoord2f (1, 1);
+- glVertex2f (wx + width, wy + height);
+- glTexCoord2f (0, 1);
+- glVertex2f (wx + width + off, wy + height);
+- glTexCoord2f (0, 1);
+- glVertex2f (wx + width + off, wy);
+-
+- glEnd ();
++ streamingBuffer->end ();
++ streamingBuffer->render (transform);
+ }
+
+ void
+ ThumbScreen::thumbPaintThumb (Thumbnail *t,
+ const GLMatrix *transform)
+ {
++ GLushort color[4];
+ int addWindowGeometryIndex;
+ CompWindow *w = t->win;
+ int wx = t->x;
+@@ -652,38 +858,37 @@
+ GLenum filter = gScreen->textureFilter ();
+ GLMatrix wTransform (*transform);
+
+- glEnable (GL_BLEND);
+ glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
+
+ if (optionGetWindowLike ())
+ {
+- glColor4f (1.0, 1.0, 1.0, t->opacity);
++ color[0] = 1;
++ color[1] = 1;
++ color[2] = 1;
++ color[3] = t->opacity * 65536;
++
+ foreach (GLTexture *tex, windowTexture)
+ {
+ tex->enable (GLTexture::Good);
+- paintTexture (wx, wy, width, height, off);
++ paintTexture (*transform, color, wx, wy, width, height, off);
+ tex->disable ();
+ }
+ }
+ else
+ {
+- glColor4us (optionGetThumbColorRed (),
+- optionGetThumbColorGreen (),
+- optionGetThumbColorBlue (),
+- optionGetThumbColorAlpha () * t->opacity);
++ color[0] = optionGetThumbColorRed ();
++ color[1] = optionGetThumbColorGreen ();
++ color[2] = optionGetThumbColorBlue ();
++ color[3] = optionGetThumbColorAlpha () * t->opacity;
+
+ foreach (GLTexture *tex, glowTexture)
+ {
+ tex->enable (GLTexture::Good);
+- paintTexture (wx, wy, width, height, off);
++ paintTexture (*transform, color, wx, wy, width, height, off);
+ tex->disable ();
+ }
+ }
+
+- glColor4usv (defaultColor);
+-
+ glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+
+ if (t->text)
+@@ -693,16 +898,11 @@
+ if (t->text->getWidth () < width)
+ ox = (width - t->text->getWidth ()) / 2.0;
+
+- t->text->draw (wx + ox, wy + height, t->opacity);
++ t->text->draw (*transform, wx + ox, wy + height, t->opacity);
+ }
+
+- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
+- glDisable (GL_BLEND);
+-
+ gScreen->setTexEnvMode (GL_REPLACE);
+
+- glColor4usv (defaultColor);
+-
+ sAttrib.opacity *= t->opacity;
+ sAttrib.yScale = t->scale;
+ sAttrib.xScale = t->scale;
+@@ -713,22 +913,17 @@
+ if (optionGetMipmap ())
+ gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR);
+
+- GLFragment::Attrib fragment (sAttrib);
+-
+ wTransform.translate (w->x (), w->y (), 0.0f);
+ wTransform.scale (sAttrib.xScale, sAttrib.yScale, 1.0f);
+ wTransform.translate (sAttrib.xTranslate / sAttrib.xScale - w->x (),
+ sAttrib.yTranslate / sAttrib.yScale - w->y (),
+ 0.0f);
+
+- glPushMatrix ();
+- glLoadMatrixf (wTransform.getMatrix ());
+ /* XXX: replacing the addWindowGeometry function like this is
+ very ugly but necessary until the vertex stage has been made
+ fully pluggable. */
+ gWindow->glAddGeometrySetCurrentIndex (MAXSHORT);
+- gWindow->glDraw (wTransform, fragment, infiniteRegion, mask);
+- glPopMatrix ();
++ gWindow->glDraw (wTransform, sAttrib, infiniteRegion, mask);
+
+ gScreen->setTextureFilter (filter);
+ }
+@@ -847,10 +1042,7 @@
+ GLMatrix sTransform = transform;
+
+ sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
+- glPushMatrix ();
+- glLoadMatrixf (sTransform.getMatrix ());
+ thumbPaintThumb (&oldThumb, &sTransform);
+- glPopMatrix ();
+ }
+
+ if (thumb.opacity > 0.0 && thumb.win)
+@@ -858,10 +1050,7 @@
+ GLMatrix sTransform = transform;
+
+ sTransform.toScreenSpace (output, -DEFAULT_Z_CAMERA);
+- glPushMatrix ();
+- glLoadMatrixf (sTransform.getMatrix ());
+ thumbPaintThumb (&thumb, &sTransform);
+- glPopMatrix ();
+ }
+ }
+
+@@ -889,10 +1078,7 @@
+
+ gScreen->glApplyTransform (attrib, output, &sTransform);
+ sTransform.toScreenSpace(output, -attrib.zTranslate);
+- glPushMatrix ();
+- glLoadMatrixf (sTransform.getMatrix ());
+ thumbPaintThumb (&oldThumb, &sTransform);
+- glPopMatrix ();
+ }
+
+ if (thumb.opacity > 0.0 && thumb.win)
+@@ -901,10 +1087,7 @@
+
+ gScreen->glApplyTransform (attrib, output, &sTransform);
+ sTransform.toScreenSpace(output, -attrib.zTranslate);
+- glPushMatrix ();
+- glLoadMatrixf (sTransform.getMatrix ());
+ thumbPaintThumb (&thumb, &sTransform);
+- glPopMatrix ();
+ }
+ }
+ }
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/thumbnail/src/thumbnail.h compiz-plugins-main-gles2/thumbnail/src/thumbnail.h
+--- compiz-plugins-main-package/thumbnail/src/thumbnail.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/thumbnail/src/thumbnail.h 2012-04-05 12:29:41.374453000 +0200
+@@ -135,14 +135,16 @@
+ positionUpdate (const CompPoint &pos);
+
+ void
+- paintTexture (int wx,
+- int wy,
+- int width,
+- int height,
+- int off);
++ paintTexture (const GLMatrix &transform,
++ GLushort *color,
++ int wx,
++ int wy,
++ int width,
++ int height,
++ int off);
+
+ void
+- thumbPaintThumb (Thumbnail *t,
++ thumbPaintThumb (Thumbnail *t,
+ const GLMatrix *transform);
+
+
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/wall/src/wall.cpp compiz-plugins-main-gles2/wall/src/wall.cpp
+--- compiz-plugins-main-package/wall/src/wall.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/wall/src/wall.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -5,10 +5,12 @@
+ * wall.cpp
+ *
+ * Copyright (c) 2006 Robert Carr <racarr@xxxxxxxxxxxxxxxxx>
++ * 2011 Linaro Limited
+ *
+ * Authors:
+ * Robert Carr <racarr@xxxxxxxxxxxxxxxxx>
+ * Dennis Kasprzyk <onestone@xxxxxxxxxxxxxxxxxxx>
++ * Travis Watkins <travis.watkins@xxxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+@@ -27,10 +29,11 @@
+ #include <string.h>
+ #include <math.h>
+ #include <sys/time.h>
+-#include <GL/glu.h>
+ #include <dlfcn.h>
+
++#include <core/core.h>
+ #include <core/atoms.h>
++#include <opengl/opengl.h>
+
+ #include "wall.h"
+
+@@ -927,25 +930,47 @@
+ }
+
+ inline void
+-wallDrawQuad (GLTexture::Matrix *matrix,
+- BOX *box)
+-{
+- glTexCoord2f (COMP_TEX_COORD_X (*matrix, box->x1),
+- COMP_TEX_COORD_Y (*matrix, box->y2));
+- glVertex2i (box->x1, box->y2);
+- glTexCoord2f (COMP_TEX_COORD_X (*matrix, box->x2),
+- COMP_TEX_COORD_Y (*matrix, box->y2));
+- glVertex2i (box->x2, box->y2);
+- glTexCoord2f (COMP_TEX_COORD_X (*matrix, box->x2),
+- COMP_TEX_COORD_Y (*matrix, box->y1));
+- glVertex2i (box->x2, box->y1);
+- glTexCoord2f (COMP_TEX_COORD_X (*matrix, box->x1),
+- COMP_TEX_COORD_Y (*matrix, box->y1));
+- glVertex2i (box->x1, box->y1);
++wallDrawQuad (const GLMatrix &transform,
++ GLTexture::Matrix *matrix,
++ BOX *box)
++{
++ GLfloat textureData[8];
++ GLfloat vertexData[12];
++ GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer ();
++
++ streamingBuffer->begin (GL_TRIANGLE_STRIP);
++
++ textureData[0] = COMP_TEX_COORD_X (*matrix, box->x1);
++ textureData[1] = COMP_TEX_COORD_Y (*matrix, box->y2);
++ textureData[2] = COMP_TEX_COORD_X (*matrix, box->x2);
++ textureData[3] = COMP_TEX_COORD_Y (*matrix, box->y2);
++ textureData[4] = COMP_TEX_COORD_X (*matrix, box->x1);
++ textureData[5] = COMP_TEX_COORD_Y (*matrix, box->y1);
++ textureData[6] = COMP_TEX_COORD_X (*matrix, box->x2);
++ textureData[7] = COMP_TEX_COORD_Y (*matrix, box->y1);
++
++ vertexData[0] = box->x1;
++ vertexData[1] = box->y2;
++ vertexData[2] = 0;
++ vertexData[3] = box->x2;
++ vertexData[4] = box->y2;
++ vertexData[5] = 0;
++ vertexData[6] = box->x1;
++ vertexData[7] = box->y1;
++ vertexData[8] = 0;
++ vertexData[9] = box->x2;
++ vertexData[10] = box->y1;
++ vertexData[11] = 0;
++
++ streamingBuffer->addTexCoords (0, 4, textureData);
++ streamingBuffer->addVertices (4, vertexData);
++
++ streamingBuffer->end ();
++ streamingBuffer->render (transform);
+ }
+
+ void
+-WallScreen::drawCairoTextureOnScreen ()
++WallScreen::drawCairoTextureOnScreen (const GLMatrix &transform)
+ {
+ float centerX, centerY;
+ float width, height;
+@@ -954,13 +979,11 @@
+ unsigned int i, j;
+ GLTexture::Matrix matrix;
+ BOX box;
++ GLMatrix wTransform (transform);
+
+ CompOutput::vector &outputDevs = screen->outputDevs ();
+ CompOutput output = outputDevs[boxOutputDevice];
+
+- glDisableClientState (GL_TEXTURE_COORD_ARRAY);
+- glEnable (GL_BLEND);
+-
+ centerX = output.x1 () + (output.width () / 2.0f);
+ centerY = output.y1 () + (output.height () / 2.0f);
+
+@@ -988,10 +1011,8 @@
+ else
+ left = 2 * left;
+
+- glScreen->setTexEnvMode (GL_MODULATE);
+-
+- glColor4f (left, left, left, left);
+- glTranslatef (0.0f, 0.0f, -(1 - left));
++// glColor4f (left, left, left, left);
++ wTransform.translate (0.0f, 0.0f, -(1 - left));
+
+ mSzCamera = -(1 - left);
+ }
+@@ -1012,9 +1033,7 @@
+ box.y2 = box.y1 + height;
+
+ switcherContext.texture[0]->enable (GLTexture::Fast);
+- glBegin (GL_QUADS);
+- wallDrawQuad (&matrix, &box);
+- glEnd ();
++ wallDrawQuad (wTransform, &matrix, &box);
+ switcherContext.texture[0]->disable ();
+
+ /* draw thumb */
+@@ -1022,7 +1041,6 @@
+ height = (float) thumbContext.height;
+
+ thumbContext.texture[0]->enable (GLTexture::Fast);
+- glBegin (GL_QUADS);
+ for (i = 0; i < (unsigned int) screen->vpSize ().width (); i++)
+ {
+ for (j = 0; j < (unsigned int) screen->vpSize ().height (); j++)
+@@ -1041,10 +1059,9 @@
+ matrix.x0 -= box.x1 * matrix.xx;
+ matrix.y0 -= box.y1 * matrix.yy;
+
+- wallDrawQuad (&matrix, &box);
++ wallDrawQuad (wTransform, &matrix, &box);
+ }
+ }
+- glEnd ();
+ thumbContext.texture[0]->disable ();
+
+ if (moving || showPreview)
+@@ -1061,9 +1078,7 @@
+ matrix.y0 -= box.y1 * matrix.yy;
+
+ highlightContext.texture[0]->enable (GLTexture::Fast);
+- glBegin (GL_QUADS);
+- wallDrawQuad (&matrix, &box);
+- glEnd ();
++ wallDrawQuad (wTransform, &matrix, &box);
+ highlightContext.texture[0]->disable ();
+
+ /* draw arrow */
+@@ -1140,26 +1155,20 @@
+ box.x2 = box.x1 + aW;
+ box.y2 = box.y1 + aH;
+
+- glTranslatef (box.x1 + aW / 2, box.y1 + aH / 2, 0.0f);
+- glRotatef (direction, 0.0f, 0.0f, 1.0f);
+- glTranslatef (-box.x1 - aW / 2, -box.y1 - aH / 2, 0.0f);
++ wTransform.translate (box.x1 + aW / 2, box.y1 + aH / 2, 0.0f);
++ wTransform.rotate (direction, 0.0f, 0.0f, 1.0f);
++ wTransform.translate (-box.x1 - aW / 2, -box.y1 - aH / 2, 0.0f);
+
+ matrix = arrowContext.texture[0]->matrix ();
+ matrix.x0 -= box.x1 * matrix.xx;
+ matrix.y0 -= box.y1 * matrix.yy;
+
+- glBegin (GL_QUADS);
+- wallDrawQuad (&matrix, &box);
+- glEnd ();
+-
++ wallDrawQuad (wTransform, &matrix, &box);
+ arrowContext.texture[0]->disable ();
+ }
+ }
+
+- glDisable (GL_BLEND);
+- glEnableClientState (GL_TEXTURE_COORD_ARRAY);
+ glScreen->setTexEnvMode (GL_REPLACE);
+- glColor4usv (defaultColor);
+ }
+
+ void
+@@ -1201,12 +1210,7 @@
+
+ sMatrix.toScreenSpace (output, -DEFAULT_Z_CAMERA);
+
+- glPushMatrix ();
+- glLoadMatrixf (sMatrix.getMatrix ());
+-
+- drawCairoTextureOnScreen ();
+-
+- glPopMatrix ();
++ drawCairoTextureOnScreen (sMatrix);
+
+ if (optionGetMiniscreen ())
+ {
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/wall/src/wall.h compiz-plugins-main-gles2/wall/src/wall.h
+--- compiz-plugins-main-package/wall/src/wall.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/wall/src/wall.h 2012-04-05 12:29:41.374453000 +0200
+@@ -103,7 +103,7 @@
+ void drawThumb ();
+ void drawHighlight ();
+ void drawArrow ();
+- void drawCairoTextureOnScreen();
++ void drawCairoTextureOnScreen (const GLMatrix &transform);
+
+ void releaseMoveWindow ();
+ void computeTranslation (float &, float &);
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/workarounds/src/workarounds.cpp compiz-plugins-main-gles2/workarounds/src/workarounds.cpp
+--- compiz-plugins-main-package/workarounds/src/workarounds.cpp 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/workarounds/src/workarounds.cpp 2012-04-05 12:29:41.374453000 +0200
+@@ -384,6 +384,7 @@
+ mfwList.remove (w->id ());
+ }
+
++#ifndef USE_GLES
+ static void
+ workaroundsProgramEnvParameter4f (GLenum target,
+ GLuint index,
+@@ -404,21 +405,25 @@
+
+ (*ws->programEnvParameter4dv) (target, index, data);
+ }
++#endif
+
+ void
+ WorkaroundsScreen::updateParameterFix ()
+ {
++#ifndef USE_GLES
+ if (!GL::programEnvParameter4f || !programEnvParameter4dv)
+ return;
+ if (optionGetAiglxFragmentFix ())
+ GL::programEnvParameter4f = workaroundsProgramEnvParameter4f;
+ else
+ GL::programEnvParameter4f = origProgramEnvParameter4f;
++#endif
+ }
+
+ void
+ WorkaroundsScreen::updateVideoSyncFix ()
+ {
++#ifndef USE_GLES
+ if ((!GL::getVideoSync || origGetVideoSync) ||
+ (!GL::waitVideoSync || origWaitVideoSync))
+ return;
+@@ -432,6 +437,7 @@
+ GL::getVideoSync = origGetVideoSync;
+ GL::waitVideoSync = origWaitVideoSync;
+ }
++#endif
+ }
+
+ void
+@@ -450,8 +456,10 @@
+ CompOutput *output,
+ unsigned int mask)
+ {
++#ifndef USE_GLES
+ if (optionGetForceGlxSync ())
+ glXWaitX ();
++#endif
+
+ return gScreen->glPaintOutput (attrib, transform, region, output, mask);
+ }
+@@ -807,6 +815,7 @@
+ foreach (CompWindow *w, screen->windows ())
+ WorkaroundsWindow::get (w)->updateSticky ();
+
++#ifndef USE_GLES
+ if (haveOpenGL)
+ {
+ updateParameterFix ();
+@@ -817,6 +826,7 @@
+ else
+ GL::copySubBuffer = origCopySubBuffer;
+ }
++#endif
+
+ if (optionGetKeepMinimizedWindows ())
+ {
+@@ -1037,6 +1047,7 @@
+ &WorkaroundsScreen::optionChanged, this,
+ _1, _2));
+
++#ifndef USE_GLES
+ if (haveOpenGL)
+ {
+ origProgramEnvParameter4f = GL::programEnvParameter4f;
+@@ -1053,18 +1064,21 @@
+
+ if (optionGetFglrxXglFix () && haveOpenGL)
+ GL::copySubBuffer = NULL;
++#endif
+
+ checkFunctions (false, true);
+ }
+
+ WorkaroundsScreen::~WorkaroundsScreen ()
+ {
++#ifndef USE_GLES
+ if (haveOpenGL)
+ {
+ GL::copySubBuffer = origCopySubBuffer;
+ GL::getVideoSync = origGetVideoSync;
+ GL::waitVideoSync = origWaitVideoSync;
+ }
++#endif
+ }
+
+ WorkaroundsWindow::WorkaroundsWindow (CompWindow *window) :
+diff -Nur '--exclude=.*' '--exclude=debian' compiz-plugins-main-package/workarounds/src/workarounds.h compiz-plugins-main-gles2/workarounds/src/workarounds.h
+--- compiz-plugins-main-package/workarounds/src/workarounds.h 2012-04-05 12:28:43.684442000 +0200
++++ compiz-plugins-main-gles2/workarounds/src/workarounds.h 2012-04-05 12:29:41.374453000 +0200
+@@ -39,9 +39,11 @@
+
+ extern bool haveOpenGL;
+
++#ifndef USE_GLES
+ typedef void (*GLProgramParameter4dvProc) (GLenum target,
+ GLuint index,
+ const GLdouble *data);
++#endif
+
+ class WorkaroundsScreen :
+ public PluginClassHandler <WorkaroundsScreen, CompScreen>,
+@@ -65,6 +67,7 @@
+
+ PropertyWriter inputDisabledAtom;
+
++#ifndef USE_GLES
+ GL::GLProgramParameter4fProc origProgramEnvParameter4f;
+ GLProgramParameter4dvProc programEnvParameter4dv;
+
+@@ -72,6 +75,7 @@
+ GL::GLXWaitVideoSyncProc origWaitVideoSync;
+
+ GL::GLXCopySubBufferProc origCopySubBuffer;
++#endif
+
+ void
+ handleEvent (XEvent *);
=== added symlink 'debian/patches/series.armel'
=== target is u'series.armhf'
=== added file 'debian/patches/series.armhf'
--- debian/patches/series.armhf 1970-01-01 00:00:00 +0000
+++ debian/patches/series.armhf 2012-04-10 14:55:08 +0000
@@ -0,0 +1,1 @@
+compiz-plugins-main-gles2.patch
=== modified file 'debian/rules'
--- debian/rules 2012-01-24 07:01:50 +0000
+++ debian/rules 2012-04-10 14:55:08 +0000
@@ -3,15 +3,40 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
+DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
+gles2_architectures := armel armhf
CORE_ABIVERSION := $(shell sed -rn 's/^\#define[[:space:]]+CORE_ABIVERSION[[:space:]]+//p' /usr/include/compiz/core/abiversion.h )
+override_dh_quilt_patch:
+ dh_quilt_patch
+ if test -r debian/patches/series.$(DEB_HOST_ARCH); then \
+ pc=".pc.$(DEB_HOST_ARCH)"; \
+ test -d "$(CURDIR)/$$pc" || mkdir "$(CURDIR)/$$pc"; \
+ cp debian/patches/series.$(DEB_HOST_ARCH) $(CURDIR)/$$pc/series; \
+ cd $(CURDIR); \
+ QUILT_PC="$$pc" quilt upgrade || true; \
+ QUILT_PC="$$pc" QUILT_PATCHES="debian/patches/" quilt push -a || true; \
+ fi; \
+
+override_dh_quilt_unpatch:
+ if test -r debian/patches/series.$(DEB_HOST_ARCH); then \
+ pc=".pc.$(DEB_HOST_ARCH)"; \
+ cd $(CURDIR); \
+ QUILT_PC="$$pc" QUILT_PATCHES="debian/patches/" quilt pop -a || true; \
+ fi; \
+ dh_quilt_unpatch
+
override_dh_auto_configure:
+ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(gles2_architectures)))
+ dh_auto_configure -- -DCOMPIZ_BUILD_WITH_RPATH=FALSE -DCOMPIZ_PACKAGING_ENABLED=TRUE -DCOMPIZ_PLUGIN_INSTALL_TYPE=package -DUSE_GSETTINGS=OFF -DCOMPIZ_DISABLE_GS_SCHEMAS_INSTALL=ON -DBUILD_GLES=ON
+else
dh_auto_configure -- -DCOMPIZ_BUILD_WITH_RPATH=FALSE -DCOMPIZ_PACKAGING_ENABLED=TRUE -DCOMPIZ_PLUGIN_INSTALL_TYPE=package -DUSE_GSETTINGS=OFF -DCOMPIZ_DISABLE_GS_SCHEMAS_INSTALL=ON
+endif
override_dh_gencontrol:
dh_gencontrol -- -Vcoreabiversion=$(CORE_ABIVERSION)
%:
- dh $@
+ dh --with quilt $@
Follow ups