From bebb3560a2bc19a792ba922ef7f03139dbbf3fdb Mon Sep 17 00:00:00 2001 From: Frederic Plourde Date: Sun, 26 Feb 2012 10:58:36 -0500 Subject: [PATCH] Added 'Cube plugin port to GLES' patch --- ...e-plugin-to-GLES-and-Enable-Rotate-plugin.patch | 1037 ++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 1038 insertions(+) create mode 100644 debian/patches/04_Port-Cube-plugin-to-GLES-and-Enable-Rotate-plugin.patch diff --git a/debian/patches/04_Port-Cube-plugin-to-GLES-and-Enable-Rotate-plugin.patch b/debian/patches/04_Port-Cube-plugin-to-GLES-and-Enable-Rotate-plugin.patch new file mode 100644 index 0000000..4c3ca61 --- /dev/null +++ b/debian/patches/04_Port-Cube-plugin-to-GLES-and-Enable-Rotate-plugin.patch @@ -0,0 +1,1037 @@ +revno 2911 +From: Frederic Plourde +Date: Sun 2012-02-26 10:52:43 -0500 +Branch-Nick: core-linaro-gles2 +Subject: Port Cube plugin ro GLES and Enable Rotate plugin + + + +--- + CMakeLists.txt | 4 + plugins/cube/CMakeLists.txt | 2 + plugins/cube/include/cube/cube.h | 1 + plugins/cube/src/cube.cpp | 750 +++++++++++++++++++++------------------ + plugins/cube/src/privates.h | 6 + plugins/rotate/CMakeLists.txt | 2 + 6 files changed, 418 insertions(+), 347 deletions(-) + +=== modified file 'CMakeLists.txt' +Index: compiz/CMakeLists.txt +=================================================================== +--- compiz.orig/CMakeLists.txt 2012-02-26 10:55:16.000000000 -0500 ++++ compiz/CMakeLists.txt 2012-02-26 10:56:18.000000000 -0500 +@@ -106,8 +106,6 @@ + + # temporarily disable plugins that aren't ported yed + set (COMPIZ_DISABLE_PLUGIN_BLUR ON) +-set (COMPIZ_DISABLE_PLUGIN_CUBE ON) +-set (COMPIZ_DISABLE_PLUGIN_ROTATE ON) + + add_subdirectory (cmake) + add_subdirectory (include) +@@ -139,5 +137,3 @@ + + # temporarily disable plugins that aren't ported yed + SET(COMPIZ_DISABLE_PLUGIN_BLUR "ON") +-SET(COMPIZ_DISABLE_PLUGIN_CUBE "ON") +-SET(COMPIZ_DISABLE_PLUGIN_ROTATE "ON") +Index: compiz/plugins/cube/CMakeLists.txt +=================================================================== +--- compiz.orig/plugins/cube/CMakeLists.txt 2012-01-25 18:45:06.000000000 -0500 ++++ compiz/plugins/cube/CMakeLists.txt 2012-02-26 10:55:46.000000000 -0500 +@@ -2,4 +2,4 @@ + + include (CompizPlugin) + +-#compiz_plugin(cube PLUGINDEPS composite opengl) ++compiz_plugin(cube PLUGINDEPS composite opengl) +Index: compiz/plugins/cube/include/cube/cube.h +=================================================================== +--- compiz.orig/plugins/cube/include/cube/cube.h 2012-01-25 18:45:06.000000000 -0500 ++++ compiz/plugins/cube/include/cube/cube.h 2012-02-26 10:55:46.000000000 -0500 +@@ -167,7 +167,6 @@ + + void repaintCaps (); + +- + friend class PrivateCubeWindow; + friend class PrivateCubeScreen; + +Index: compiz/plugins/cube/src/cube.cpp +=================================================================== +--- compiz.orig/plugins/cube/src/cube.cpp 2012-02-23 20:19:16.000000000 -0500 ++++ compiz/plugins/cube/src/cube.cpp 2012-02-26 10:55:46.000000000 -0500 +@@ -277,7 +277,7 @@ + + return true; + } +- ++ + void + PrivateCubeScreen::updateOutputs () + { +@@ -379,244 +379,247 @@ + } + } + +-void +-PrivateCubeScreen::updateSkydomeTexture () +-{ +- mSky.clear (); +- +- if (!optionGetSkydome ()) +- return; +- +- CompString imgName = optionGetSkydomeImage (); +- CompString pname = "cube"; +- +- if (optionGetSkydomeImage ().empty () || +- (mSky = GLTexture::readImageToTexture (imgName, pname, mSkySize)).empty ()) +- { +- GLfloat aaafTextureData[128][128][3]; +- GLfloat fRStart = (GLfloat) optionGetSkydomeGradientStartColorRed () / 0xffff; +- GLfloat fGStart = (GLfloat) optionGetSkydomeGradientStartColorGreen () / 0xffff; +- GLfloat fBStart = (GLfloat) optionGetSkydomeGradientStartColorBlue () / 0xffff; +- GLfloat fREnd = (GLfloat) optionGetSkydomeGradientEndColorRed () / 0xffff; +- GLfloat fGEnd = (GLfloat) optionGetSkydomeGradientEndColorGreen () / 0xffff; +- GLfloat fBEnd = (GLfloat) optionGetSkydomeGradientEndColorBlue () / 0xffff; +- GLfloat fRStep = (fREnd - fRStart) / 128.0f; +- GLfloat fGStep = (fGEnd - fGStart) / 128.0f; +- GLfloat fBStep = (fBStart - fBEnd) / 128.0f; +- GLfloat fR = fRStart; +- GLfloat fG = fGStart; +- GLfloat fB = fBStart; +- +- int iX, iY; +- +- for (iX = 127; iX >= 0; iX--) +- { +- fR += fRStep; +- fG += fGStep; +- fB -= fBStep; +- +- for (iY = 0; iY < 128; iY++) +- { +- aaafTextureData[iX][iY][0] = fR; +- aaafTextureData[iX][iY][1] = fG; +- aaafTextureData[iX][iY][2] = fB; +- } +- } +- +- mSkySize = CompSize (128, 128); +- +- mSky = GLTexture::imageDataToTexture ((char *) aaafTextureData, +- mSkySize, GL_RGB, GL_FLOAT); +- +- mSky[0]->setFilter (GL_LINEAR); +- mSky[0]->setWrap (GL_CLAMP_TO_EDGE); +- } +-} +- +-static bool +-fillCircleTable (GLfloat **ppSint, +- GLfloat **ppCost, +- const int n) +-{ +- const GLfloat angle = 2 * M_PI / (GLfloat) ((n == 0) ? 1 : n); +- const int size = abs (n); +- int i; +- +- *ppSint = (GLfloat *) calloc (sizeof (GLfloat), size + 1); +- *ppCost = (GLfloat *) calloc (sizeof (GLfloat), size + 1); +- +- if (!(*ppSint) || !(*ppCost)) +- { +- free (*ppSint); +- free (*ppCost); +- +- return false; +- } +- +- (*ppSint)[0] = 0.0; +- (*ppCost)[0] = 1.0; +- +- for (i = 1; i < size; i++) +- { +- (*ppSint)[i] = sin (angle * i); +- (*ppCost)[i] = cos (angle * i); +- } +- +- (*ppSint)[size] = (*ppSint)[0]; +- (*ppCost)[size] = (*ppCost)[0]; +- +- return true; +-} +- +-void +-PrivateCubeScreen::updateSkydomeList (GLfloat fRadius) +-{ +- GLint iSlices = 128; +- GLint iStacks = 64; +- GLfloat afTexCoordX[4]; +- GLfloat afTexCoordY[4]; +- GLfloat *sint1; +- GLfloat *cost1; +- GLfloat *sint2; +- GLfloat *cost2; +- GLfloat r; +- GLfloat x; +- GLfloat y; +- GLfloat z; +- int i; +- int j; +- int iStacksStart; +- int iStacksEnd; +- int iSlicesStart; +- int iSlicesEnd; +- GLfloat fStepX; +- GLfloat fStepY; +- +- if (optionGetSkydomeAnimated ()) +- { +- iStacksStart = 11; /* min. 0 */ +- iStacksEnd = 53; /* max. 64 */ +- iSlicesStart = 0; /* min. 0 */ +- iSlicesEnd = 128; /* max. 128 */ +- } +- else +- { +- iStacksStart = 21; /* min. 0 */ +- iStacksEnd = 43; /* max. 64 */ +- iSlicesStart = 21; /* min. 0 */ +- iSlicesEnd = 44; /* max. 128 */ +- } +- +- fStepX = 1.0 / (GLfloat) (iSlicesEnd - iSlicesStart); +- fStepY = 1.0 / (GLfloat) (iStacksEnd - iStacksStart); +- +- if (!mSky.size ()) +- return; +- +- if (!fillCircleTable (&sint1, &cost1, -iSlices)) +- return; +- +- if (!fillCircleTable (&sint2, &cost2, iStacks * 2)) +- { +- free (sint1); +- free (cost1); +- return; +- } +- +- afTexCoordX[0] = 1.0f; +- afTexCoordY[0] = 1.0f - fStepY; +- afTexCoordX[1] = 1.0f - fStepX; +- afTexCoordY[1] = 1.0f - fStepY; +- afTexCoordX[2] = 1.0f - fStepX; +- afTexCoordY[2] = 1.0f; +- afTexCoordX[3] = 1.0f; +- afTexCoordY[3] = 1.0f; +- +- if (!mSkyListId) +- mSkyListId = glGenLists (1); +- +- glNewList (mSkyListId, GL_COMPILE); +- +- mSky[0]->enable (GLTexture::Good); +- +- glBegin (GL_QUADS); +- +- for (i = iStacksStart; i < iStacksEnd; i++) +- { +- afTexCoordX[0] = 1.0f; +- afTexCoordX[1] = 1.0f - fStepX; +- afTexCoordX[2] = 1.0f - fStepX; +- afTexCoordX[3] = 1.0f; +- +- for (j = iSlicesStart; j < iSlicesEnd; j++) +- { +- /* bottom-right */ +- z = cost2[i]; +- r = sint2[i]; +- x = cost1[j]; +- y = sint1[j]; +- +- glTexCoord2f ( +- COMP_TEX_COORD_X (mSky[0]->matrix (), afTexCoordX[3] * mSkySize.width ()), +- COMP_TEX_COORD_Y (mSky[0]->matrix (), afTexCoordY[3] * mSkySize.height ())); +- glVertex3f (x * r * fRadius, y * r * fRadius, z * fRadius); +- +- /* top-right */ +- z = cost2[i + 1]; +- r = sint2[i + 1]; +- x = cost1[j]; +- y = sint1[j]; +- +- glTexCoord2f ( +- COMP_TEX_COORD_X (mSky[0]->matrix (), afTexCoordX[0] * mSkySize.width ()), +- COMP_TEX_COORD_Y (mSky[0]->matrix (), afTexCoordY[0] * mSkySize.height ())); +- glVertex3f (x * r * fRadius, y * r * fRadius, z * fRadius); +- +- /* top-left */ +- z = cost2[i + 1]; +- r = sint2[i + 1]; +- x = cost1[j + 1]; +- y = sint1[j + 1]; +- +- glTexCoord2f ( +- COMP_TEX_COORD_X (mSky[0]->matrix (), afTexCoordX[1] * mSkySize.width ()), +- COMP_TEX_COORD_Y (mSky[0]->matrix (), afTexCoordY[1] * mSkySize.height ())); +- glVertex3f (x * r * fRadius, y * r * fRadius, z * fRadius); +- +- /* bottom-left */ +- z = cost2[i]; +- r = sint2[i]; +- x = cost1[j + 1]; +- y = sint1[j + 1]; +- +- glTexCoord2f ( +- COMP_TEX_COORD_X (mSky[0]->matrix (), afTexCoordX[2] * mSkySize.width ()), +- COMP_TEX_COORD_Y (mSky[0]->matrix (), afTexCoordY[2] * mSkySize.height ())); +- glVertex3f (x * r * fRadius, y * r * fRadius, z * fRadius); +- +- afTexCoordX[0] -= fStepX; +- afTexCoordX[1] -= fStepX; +- afTexCoordX[2] -= fStepX; +- afTexCoordX[3] -= fStepX; +- } +- +- afTexCoordY[0] -= fStepY; +- afTexCoordY[1] -= fStepY; +- afTexCoordY[2] -= fStepY; +- afTexCoordY[3] -= fStepY; +- } +- +- glEnd (); +- +- mSky[0]->disable (); +- +- glEndList (); +- +- free (sint1); +- free (cost1); +- free (sint2); +- free (cost2); +-} ++//// skydome ++// void ++// PrivateCubeScreen::updateSkydomeTexture () ++// { ++// mSky.clear (); ++// ++// if (!optionGetSkydome ()) ++// return; ++// ++// CompString imgName = optionGetSkydomeImage (); ++// CompString pname = "cube"; ++// ++// if (optionGetSkydomeImage ().empty () || ++// (mSky = GLTexture::readImageToTexture (imgName, pname, mSkySize)).empty ()) ++// { ++// GLfloat aaafTextureData[128][128][3]; ++// GLfloat fRStart = (GLfloat) optionGetSkydomeGradientStartColorRed () / 0xffff; ++// GLfloat fGStart = (GLfloat) optionGetSkydomeGradientStartColorGreen () / 0xffff; ++// GLfloat fBStart = (GLfloat) optionGetSkydomeGradientStartColorBlue () / 0xffff; ++// GLfloat fREnd = (GLfloat) optionGetSkydomeGradientEndColorRed () / 0xffff; ++// GLfloat fGEnd = (GLfloat) optionGetSkydomeGradientEndColorGreen () / 0xffff; ++// GLfloat fBEnd = (GLfloat) optionGetSkydomeGradientEndColorBlue () / 0xffff; ++// GLfloat fRStep = (fREnd - fRStart) / 128.0f; ++// GLfloat fGStep = (fGEnd - fGStart) / 128.0f; ++// GLfloat fBStep = (fBStart - fBEnd) / 128.0f; ++// GLfloat fR = fRStart; ++// GLfloat fG = fGStart; ++// GLfloat fB = fBStart; ++// ++// int iX, iY; ++// ++// for (iX = 127; iX >= 0; iX--) ++// { ++// fR += fRStep; ++// fG += fGStep; ++// fB -= fBStep; ++// ++// for (iY = 0; iY < 128; iY++) ++// { ++// aaafTextureData[iX][iY][0] = fR; ++// aaafTextureData[iX][iY][1] = fG; ++// aaafTextureData[iX][iY][2] = fB; ++// } ++// } ++// ++// mSkySize = CompSize (128, 128); ++// ++// mSky = GLTexture::imageDataToTexture ((char *) aaafTextureData, ++// mSkySize, GL_RGB, GL_FLOAT); ++// ++// mSky[0]->setFilter (GL_LINEAR); ++// mSky[0]->setWrap (GL_CLAMP_TO_EDGE); ++// } ++// } ++ ++//// skydome ++// static bool ++// fillCircleTable (GLfloat **ppSint, ++// GLfloat **ppCost, ++// const int n) ++// { ++// const GLfloat angle = 2 * M_PI / (GLfloat) ((n == 0) ? 1 : n); ++// const int size = abs (n); ++// int i; ++// ++// *ppSint = (GLfloat *) calloc (sizeof (GLfloat), size + 1); ++// *ppCost = (GLfloat *) calloc (sizeof (GLfloat), size + 1); ++// ++// if (!(*ppSint) || !(*ppCost)) ++// { ++// free (*ppSint); ++// free (*ppCost); ++// ++// return false; ++// } ++// ++// (*ppSint)[0] = 0.0; ++// (*ppCost)[0] = 1.0; ++// ++// for (i = 1; i < size; i++) ++// { ++// (*ppSint)[i] = sin (angle * i); ++// (*ppCost)[i] = cos (angle * i); ++// } ++// ++// (*ppSint)[size] = (*ppSint)[0]; ++// (*ppCost)[size] = (*ppCost)[0]; ++// ++// return true; ++// } ++ ++//// skydome ++// void ++// PrivateCubeScreen::updateSkydomeList (GLfloat fRadius) ++// { ++// GLint iSlices = 128; ++// GLint iStacks = 64; ++// GLfloat afTexCoordX[4]; ++// GLfloat afTexCoordY[4]; ++// GLfloat *sint1; ++// GLfloat *cost1; ++// GLfloat *sint2; ++// GLfloat *cost2; ++// GLfloat r; ++// GLfloat x; ++// GLfloat y; ++// GLfloat z; ++// int i; ++// int j; ++// int iStacksStart; ++// int iStacksEnd; ++// int iSlicesStart; ++// int iSlicesEnd; ++// GLfloat fStepX; ++// GLfloat fStepY; ++// ++// if (optionGetSkydomeAnimated ()) ++// { ++// iStacksStart = 11; /* min. 0 */ ++// iStacksEnd = 53; /* max. 64 */ ++// iSlicesStart = 0; /* min. 0 */ ++// iSlicesEnd = 128; /* max. 128 */ ++// } ++// else ++// { ++// iStacksStart = 21; /* min. 0 */ ++// iStacksEnd = 43; /* max. 64 */ ++// iSlicesStart = 21; /* min. 0 */ ++// iSlicesEnd = 44; /* max. 128 */ ++// } ++// ++// fStepX = 1.0 / (GLfloat) (iSlicesEnd - iSlicesStart); ++// fStepY = 1.0 / (GLfloat) (iStacksEnd - iStacksStart); ++// ++// if (!mSky.size ()) ++// return; ++// ++// if (!fillCircleTable (&sint1, &cost1, -iSlices)) ++// return; ++// ++// if (!fillCircleTable (&sint2, &cost2, iStacks * 2)) ++// { ++// free (sint1); ++// free (cost1); ++// return; ++// } ++// ++// afTexCoordX[0] = 1.0f; ++// afTexCoordY[0] = 1.0f - fStepY; ++// afTexCoordX[1] = 1.0f - fStepX; ++// afTexCoordY[1] = 1.0f - fStepY; ++// afTexCoordX[2] = 1.0f - fStepX; ++// afTexCoordY[2] = 1.0f; ++// afTexCoordX[3] = 1.0f; ++// afTexCoordY[3] = 1.0f; ++// ++// if (!mSkyListId) ++// mSkyListId = glGenLists (1); ++// ++// glNewList (mSkyListId, GL_COMPILE); ++// ++// mSky[0]->enable (GLTexture::Good); ++// ++// glBegin (GL_QUADS); ++// ++// for (i = iStacksStart; i < iStacksEnd; i++) ++// { ++// afTexCoordX[0] = 1.0f; ++// afTexCoordX[1] = 1.0f - fStepX; ++// afTexCoordX[2] = 1.0f - fStepX; ++// afTexCoordX[3] = 1.0f; ++// ++// for (j = iSlicesStart; j < iSlicesEnd; j++) ++// { ++// /* bottom-right */ ++// z = cost2[i]; ++// r = sint2[i]; ++// x = cost1[j]; ++// y = sint1[j]; ++// ++// glTexCoord2f ( ++// COMP_TEX_COORD_X (mSky[0]->matrix (), afTexCoordX[3] * mSkySize.width ()), ++// COMP_TEX_COORD_Y (mSky[0]->matrix (), afTexCoordY[3] * mSkySize.height ())); ++// glVertex3f (x * r * fRadius, y * r * fRadius, z * fRadius); ++// ++// /* top-right */ ++// z = cost2[i + 1]; ++// r = sint2[i + 1]; ++// x = cost1[j]; ++// y = sint1[j]; ++// ++// glTexCoord2f ( ++// COMP_TEX_COORD_X (mSky[0]->matrix (), afTexCoordX[0] * mSkySize.width ()), ++// COMP_TEX_COORD_Y (mSky[0]->matrix (), afTexCoordY[0] * mSkySize.height ())); ++// glVertex3f (x * r * fRadius, y * r * fRadius, z * fRadius); ++// ++// /* top-left */ ++// z = cost2[i + 1]; ++// r = sint2[i + 1]; ++// x = cost1[j + 1]; ++// y = sint1[j + 1]; ++// ++// glTexCoord2f ( ++// COMP_TEX_COORD_X (mSky[0]->matrix (), afTexCoordX[1] * mSkySize.width ()), ++// COMP_TEX_COORD_Y (mSky[0]->matrix (), afTexCoordY[1] * mSkySize.height ())); ++// glVertex3f (x * r * fRadius, y * r * fRadius, z * fRadius); ++// ++// /* bottom-left */ ++// z = cost2[i]; ++// r = sint2[i]; ++// x = cost1[j + 1]; ++// y = sint1[j + 1]; ++// ++// glTexCoord2f ( ++// COMP_TEX_COORD_X (mSky[0]->matrix (), afTexCoordX[2] * mSkySize.width ()), ++// COMP_TEX_COORD_Y (mSky[0]->matrix (), afTexCoordY[2] * mSkySize.height ())); ++// glVertex3f (x * r * fRadius, y * r * fRadius, z * fRadius); ++// ++// afTexCoordX[0] -= fStepX; ++// afTexCoordX[1] -= fStepX; ++// afTexCoordX[2] -= fStepX; ++// afTexCoordX[3] -= fStepX; ++// } ++// ++// afTexCoordY[0] -= fStepY; ++// afTexCoordY[1] -= fStepY; ++// afTexCoordY[2] -= fStepY; ++// afTexCoordY[3] -= fStepY; ++// } ++// ++// glEnd (); ++// ++// mSky[0]->disable (); ++// ++// glEndList (); ++// ++// free (sint1); ++// free (cost1); ++// free (sint2); ++// free (cost2); ++// } + + bool + PrivateCubeScreen::setOption (const CompString &name, CompOption::Value &value) +@@ -633,15 +636,16 @@ + case CubeOptions::In: + rv = updateGeometry (screen->vpSize ().width (), value.b () ? -1 : 1); + break; +- case CubeOptions::Skydome: +- case CubeOptions::SkydomeImage: +- case CubeOptions::SkydomeAnimated: +- case CubeOptions::SkydomeGradientStartColor: +- case CubeOptions::SkydomeGradientEndColor: +- updateSkydomeTexture (); +- updateSkydomeList (1.0f); +- cScreen->damageScreen (); +- break; ++//// skydome ++// case CubeOptions::Skydome: ++// case CubeOptions::SkydomeImage: ++// case CubeOptions::SkydomeAnimated: ++// case CubeOptions::SkydomeGradientStartColor: ++// case CubeOptions::SkydomeGradientEndColor: ++// updateSkydomeTexture (); ++// updateSkydomeList (1.0f); ++// cScreen->damageScreen (); ++// break; + case CubeOptions::MultioutputMode: + updateOutputs (); + updateGeometry (screen->vpSize ().width (), mInvert); +@@ -787,7 +791,7 @@ + CompOutput *output, + unsigned int mask) + { +- if (mGrabIndex || mDesktopOpacity != OPAQUE) ++ //if (mGrabIndex || mDesktopOpacity != OPAQUE) + { + mask &= ~PAINT_SCREEN_REGION_MASK; + mask |= PAINT_SCREEN_TRANSFORMED_MASK; +@@ -818,7 +822,7 @@ + { + WRAPABLE_HND_FUNC_RETURN (5, bool, cubeCheckOrientation, sAttrib, transform, output, points) + GLMatrix sTransform = transform; +- GLMatrix mvp, pm (priv->gScreen->projectionMatrix ()); ++ GLMatrix mvp, pm (*priv->gScreen->projectionMatrix ()); + GLVector pntA, pntB, pntC; + GLVector vecA, vecB, ortho; + bool rv = false; +@@ -1060,27 +1064,28 @@ + { + WRAPABLE_HND_FUNC (1, cubeClearTargetOutput, xRotate, vRotate) + +- if (priv->mSky.size () > 0) +- { +- priv->gScreen->setLighting (false); +- +- glPushMatrix (); +- +- if (priv->optionGetSkydomeAnimated () && +- priv->mGrabIndex == 0) +- { +- glRotatef (vRotate / 5.0f + 90.0f, 1.0f, 0.0f, 0.0f); +- glRotatef (xRotate, 0.0f, 0.0f, -1.0f); +- } +- else +- { +- glRotatef (90.0f, 1.0f, 0.0f, 0.0f); +- } +- +- glCallList (priv->mSkyListId); +- glPopMatrix (); +- } +- else ++//// skydome ++// if (priv->mSky.size () > 0) ++// { ++// priv->gScreen->setLighting (false); ++// ++// glPushMatrix (); ++// ++// if (priv->optionGetSkydomeAnimated () && ++// priv->mGrabIndex == 0) ++// { ++// glRotatef (vRotate / 5.0f + 90.0f, 1.0f, 0.0f, 0.0f); ++// glRotatef (xRotate, 0.0f, 0.0f, -1.0f); ++// } ++// else ++// { ++// glRotatef (90.0f, 1.0f, 0.0f, 0.0f); ++// } ++// ++// glCallList (priv->mSkyListId); ++// glPopMatrix (); ++// } ++// else + { + priv->gScreen->clearTargetOutput (GL_COLOR_BUFFER_BIT); + } +@@ -1094,61 +1099,83 @@ + { + WRAPABLE_HND_FUNC (2, cubePaintTop, sAttrib, transform, output, size) + ++ GLfloat normal[3]; + GLScreenPaintAttrib sa = sAttrib; + GLMatrix sTransform = transform; ++ GLVertexBuffer* vertexBuffer = GLVertexBuffer::streamingBuffer (); + + unsigned short* color; + int opacity; + +- priv->gScreen->setLighting (true); ++ //priv->gScreen->setLighting (true); + + color = priv->optionGetTopColor (); + opacity = priv->mDesktopOpacity * color[3] / 0xffff; + +- glColor4us (color[0] * opacity / 0xffff, +- color[1] * opacity / 0xffff, +- color[2] * opacity / 0xffff, +- opacity); ++// glColor4us (color[0] * opacity / 0xffff, ++// color[1] * opacity / 0xffff, ++// color[2] * opacity / 0xffff, ++// opacity); ++ color[0] = color[0] * opacity / 0xffff; ++ color[1] = color[1] * opacity / 0xffff; ++ color[2] = color[2] * opacity / 0xffff; ++ color[3] = opacity; ++ ++ vertexBuffer->begin (GL_TRIANGLE_FAN); ++ vertexBuffer->addColors (1, color); + +- glPushMatrix (); ++ //glPushMatrix (); + + sa.yRotate += (360.0f / size) * (priv->mXRotations + 1); + + priv->gScreen->glApplyTransform (sa, output, &sTransform); + +- glLoadMatrixf (sTransform.getMatrix ()); +- glTranslatef (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f); +- glScalef (priv->mOutputXScale, priv->mOutputYScale, 1.0f); ++// glLoadMatrixf (sTransform.getMatrix ()); ++// glTranslatef (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f); ++// glScalef (priv->mOutputXScale, priv->mOutputYScale, 1.0f); + ++#ifndef USE_GLES + if ((priv->mDesktopOpacity != OPAQUE) || (color[3] != OPAQUE)) + { + priv->gScreen->setTexEnvMode (GL_MODULATE); + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } ++#endif + +- glVertexPointer (3, GL_FLOAT, 0, priv->mVertices); ++ //glVertexPointer (3, GL_FLOAT, 0, priv->mVertices); ++ normal[0] = priv->curNormal[0]; ++ normal[1] = priv->curNormal[1]; ++ normal[2] = priv->curNormal[2]; ++ vertexBuffer->addNormals (1, &normal[0]); ++ vertexBuffer->addVertices (priv->mNVertices, &priv->mVertices[0]); + + if (priv->mInvert == 1 && size == 4 && priv->mTexture.size ()) + { +- priv->mTexture[0]->enable (GLTexture::Good); +- glTexCoordPointer (2, GL_FLOAT, 0, priv->mTc); +- glDrawArrays (GL_TRIANGLE_FAN, 0, priv->mNVertices >> 1); +- priv->mTexture[0]->disable (); +- glDisableClientState (GL_TEXTURE_COORD_ARRAY); +- } +- else +- { +- glDisableClientState (GL_TEXTURE_COORD_ARRAY); +- glDrawArrays (GL_TRIANGLE_FAN, 0, priv->mNVertices >> 1); +- } ++ //priv->mTexture[0]->enable (GLTexture::Good); ++ //glTexCoordPointer (2, GL_FLOAT, 0, priv->mTc); ++ //glDrawArrays (GL_TRIANGLE_FAN, 0, priv->mNVertices >> 1); ++ //priv->mTexture[0]->disable (); ++ //glDisableClientState (GL_TEXTURE_COORD_ARRAY); ++ vertexBuffer->addTexCoords (priv->mTexture[0]->name (), ++ priv->mNVertices, ++ priv->mTc); ++ } ++// else ++// { ++// glDisableClientState (GL_TEXTURE_COORD_ARRAY); ++// glDrawArrays (GL_TRIANGLE_FAN, 0, priv->mNVertices >> 1); ++// } ++ ++ vertexBuffer->end (); ++ vertexBuffer->render (); + +- glPopMatrix (); ++ //glPopMatrix (); + +- glColor4usv (defaultColor); +- glEnableClientState (GL_TEXTURE_COORD_ARRAY); ++ //glColor4usv (defaultColor); ++ //glEnableClientState (GL_TEXTURE_COORD_ARRAY); + +- priv->gScreen->setTexEnvMode (GL_REPLACE); +- glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); ++ //priv->gScreen->setTexEnvMode (GL_REPLACE); ++ //glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } + + void +@@ -1159,51 +1186,69 @@ + { + WRAPABLE_HND_FUNC (3, cubePaintBottom, sAttrib, transform, output, size) + ++ GLfloat normal[3]; + GLScreenPaintAttrib sa = sAttrib; + GLMatrix sTransform = transform; ++ GLVertexBuffer* vertexBuffer = GLVertexBuffer::streamingBuffer (); + + unsigned short* color; + int opacity; + +- priv->gScreen->setLighting (true); ++ //priv->gScreen->setLighting (true); + + color = priv->optionGetBottomColor (); + opacity = priv->mDesktopOpacity * color[3] / 0xffff; + +- glColor4us (color[0] * opacity / 0xffff, +- color[1] * opacity / 0xffff, +- color[2] * opacity / 0xffff, +- opacity); ++// glColor4us (color[0] * opacity / 0xffff, ++// color[1] * opacity / 0xffff, ++// color[2] * opacity / 0xffff, ++// opacity); ++ ++ color[0] = color[0] * opacity / 0xffff; ++ color[1] = color[1] * opacity / 0xffff; ++ color[2] = color[2] * opacity / 0xffff; ++ color[3] = opacity; ++ ++ vertexBuffer->begin (GL_TRIANGLE_FAN); ++ vertexBuffer->addColors (1, color); + +- glPushMatrix (); ++// glPushMatrix (); + + sa.yRotate += (360.0f / size) * (priv->mXRotations + 1); + + priv->gScreen->glApplyTransform (sa, output, &sTransform); + +- glLoadMatrixf (sTransform.getMatrix ()); +- glTranslatef (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f); +- glScalef (priv->mOutputXScale, priv->mOutputYScale, 1.0f); ++// glLoadMatrixf (sTransform.getMatrix ()); ++// glTranslatef (priv->mOutputXOffset, -priv->mOutputYOffset, 0.0f); ++// glScalef (priv->mOutputXScale, priv->mOutputYScale, 1.0f); + ++#ifndef USE_GLES + if ((priv->mDesktopOpacity != OPAQUE) || (color[3] != OPAQUE)) + { + priv->gScreen->setTexEnvMode (GL_MODULATE); + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } ++#endif + +- glVertexPointer (3, GL_FLOAT, 0, priv->mVertices); +- +- +- glDisableClientState (GL_TEXTURE_COORD_ARRAY); +- glDrawArrays (GL_TRIANGLE_FAN, priv->mNVertices >> 1, priv->mNVertices >> 1); +- +- glPopMatrix (); +- +- glColor4usv (defaultColor); +- glEnableClientState (GL_TEXTURE_COORD_ARRAY); +- +- priv->gScreen->setTexEnvMode (GL_REPLACE); +- glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); ++// glVertexPointer (3, GL_FLOAT, 0, priv->mVertices); ++ normal[0] = priv->curNormal[0]; ++ normal[1] = priv->curNormal[1]; ++ normal[2] = priv->curNormal[2]; ++ vertexBuffer->addNormals (1, &normal[0]); ++ vertexBuffer->addVertices (priv->mNVertices, &priv->mVertices[0]); ++ ++ vertexBuffer->end (); ++ ++// glDisableClientState (GL_TEXTURE_COORD_ARRAY); ++// glDrawArrays (GL_TRIANGLE_FAN, priv->mNVertices >> 1, priv->mNVertices >> 1); ++// ++// glPopMatrix (); ++// ++// glColor4usv (defaultColor); ++// glEnableClientState (GL_TEXTURE_COORD_ARRAY); ++// ++// priv->gScreen->setTexEnvMode (GL_REPLACE); ++// glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } + + void +@@ -1220,6 +1265,7 @@ + const CompRegion ®ion, + CompOutput *output) + { ++#ifndef USE_GLES + if (mRotationState != CubeScreen::RotationNone) + { + glPushMatrix (); +@@ -1259,6 +1305,7 @@ + } + else + gScreen->glEnableOutputClipping (transform, region, output); ++#endif + } + + void +@@ -1391,8 +1438,10 @@ + + sa.xRotate = sa.xRotate / size * hsize; + ++#ifndef USE_GLES + if (mGrabIndex && optionGetMipmap ()) + gScreen->setTextureFilter (GL_LINEAR_MIPMAP_LINEAR); ++#endif + + if (mInvert == 1) + { +@@ -1420,7 +1469,8 @@ + cubeScreen->cubeShouldPaintAllViewports () || sa.vRotate != 0.0f || + sa.yTranslate != 0.0f); + +- if (paintCaps) ++ //if (paintCaps) ++ if (0) + { + Bool topDir, bottomDir, allCaps; + +@@ -1443,38 +1493,48 @@ + + if (topDir && bottomDir) + { +- glNormal3f (0.0f, -1.0f, 0.0f); ++ //glNormal3f (0.0f, -1.0f, 0.0f); ++ curNormal = GLVector (0.0f, -1.0f, 0.0f); + if (allCaps) + { + cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize); +- glNormal3f (0.0f, 0.0f, -1.0f); ++ ++// glNormal3f (0.0f, 0.0f, -1.0f); ++ curNormal = GLVector (0.0f, 0.0f, -1.0f); + cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize); +- glNormal3f (0.0f, -1.0f, 0.0f); ++ ++// glNormal3f (0.0f, -1.0f, 0.0f); ++ curNormal = GLVector (0.0f, -1.0f, 0.0f); + } + cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize); + } + else if (!topDir && !bottomDir) + { +- glNormal3f (0.0f, 1.0f, 0.0f); ++// glNormal3f (0.0f, 1.0f, 0.0f); ++ curNormal = GLVector (0.0f, 1.0f, 0.0f); + if (allCaps) + { + cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize); +- glNormal3f (0.0f, 0.0f, -1.0f); ++// glNormal3f (0.0f, 0.0f, -1.0f); ++ curNormal = GLVector (0.0f, 0.0f, -1.0f); + cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize); +- glNormal3f (0.0f, 1.0f, 0.0f); ++// glNormal3f (0.0f, 1.0f, 0.0f); ++ curNormal = GLVector (0.0f, 1.0f, 0.0f); + } + cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize); + } + else if (allCaps) + { +- glNormal3f (0.0f, 1.0f, 0.0f); ++// glNormal3f (0.0f, 1.0f, 0.0f); ++ curNormal = GLVector (0.0f, 1.0f, 0.0f); + cubeScreen->cubePaintTop (sa, transform, outputPtr, hsize); +- glNormal3f (0.0f, -1.0f, 0.0f); ++// glNormal3f (0.0f, -1.0f, 0.0f); ++ curNormal = GLVector (0.0f, -1.0f, 0.0f); + cubeScreen->cubePaintBottom (sa, transform, outputPtr, hsize); +- glNormal3f (0.0f, 0.0f, -1.0f); ++// glNormal3f (0.0f, 0.0f, -1.0f); ++ curNormal = GLVector (0.0f, 0.0f, -1.0f); + cubeScreen->cubePaintInside (sa, transform, outputPtr, hsize); + } +- glNormal3f (0.0f, 0.0f, -1.0f); + } + + if (wasCulled) +@@ -1578,6 +1638,8 @@ + + if (state & CompAction::StateInitKey) + action->setState (action->state () | CompAction::StateTermKey); ++ ++// cs->priv->setCallbacks (true); + } + + return false; +@@ -1634,6 +1696,15 @@ + return status; + } + ++void ++PrivateCubeScreen::setCallbacks (bool flag) ++{ ++ cScreen->preparePaintSetEnabled (this, flag); ++ gScreen->glPaintOutputSetEnabled (this, flag); ++ gScreen->glPaintTransformedOutputSetEnabled (this, flag); ++ cScreen->donePaintSetEnabled (this, flag); ++} ++ + PrivateCubeScreen::PrivateCubeScreen (CompScreen *s) : + cScreen (CompositeScreen::get (s)), + gScreen (GLScreen::get (s)), +@@ -1694,6 +1765,8 @@ + ScreenInterface::setHandler (s); + CompositeScreenInterface::setHandler (cScreen); + GLScreenInterface::setHandler (gScreen); ++ ++// setCallbacks (false); + } + + PrivateCubeScreen::~PrivateCubeScreen () +@@ -1701,8 +1774,9 @@ + if (mVertices) + free (mVertices); + +- if (mSkyListId) +- glDeleteLists (mSkyListId, 1); ++//// skydome ++// if (mSkyListId) ++// glDeleteLists (mSkyListId, 1); + } + + +Index: compiz/plugins/cube/src/privates.h +=================================================================== +--- compiz.orig/plugins/cube/src/privates.h 2012-01-25 18:45:06.000000000 -0500 ++++ compiz/plugins/cube/src/privates.h 2012-02-26 10:55:46.000000000 -0500 +@@ -68,6 +68,8 @@ + const char *name, + CompOption::Value &v); + ++ void setCallbacks (bool flag); ++ + void outputChangeNotify (); + + const CompWindowList & getWindowPaintList (); +@@ -116,7 +118,7 @@ + + bool mPaintAllViewports; + +- GLfloat mDistance; ++ GLfloat mDistance; + GLfloat mTc[12]; + + CompScreen::GrabHandle mGrabIndex; +@@ -157,7 +159,7 @@ + int mLastOpacityIndex; + + bool mRecalcOutput; +- ++ GLVector curNormal; + CompWindowList mReversedWindowList; + }; + +Index: compiz/plugins/rotate/CMakeLists.txt +=================================================================== +--- compiz.orig/plugins/rotate/CMakeLists.txt 2012-01-25 18:45:06.000000000 -0500 ++++ compiz/plugins/rotate/CMakeLists.txt 2012-02-26 10:55:46.000000000 -0500 +@@ -2,4 +2,4 @@ + + include (CompizPlugin) + +-#compiz_plugin(rotate PLUGINDEPS composite opengl cube) ++compiz_plugin(rotate PLUGINDEPS composite opengl cube) diff --git a/debian/patches/series b/debian/patches/series index 089b9f3..ceb96c2 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ 01_Port-the-Wobbly-plugins-to-gles.patch 02_Enable-the-Wobbly-plugin.patch 03_Enable-the-Wobbly-plugin-take-II.patch +04_Port-Cube-plugin-to-GLES-and-Enable-Rotate-plugin.patch -- 1.7.10