summaryrefslogtreecommitdiff
diff options
-rw-r--r--CMakeLists.txt4
-rw-r--r--plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp31
-rw-r--r--plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.h4
-rw-r--r--plugins/unitydialog/src/unitydialog.cpp98
-rw-r--r--plugins/unitydialog/src/unitydialog.h24
5 files changed, 153 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 359efd68e..0f20d1753 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -136,6 +136,10 @@ add_subdirectory(UnityCore)
add_subdirectory(guides)
add_subdirectory(standalone-clients EXCLUDE_FROM_ALL)
+if (USE_GLES)
+ SET (MAINTAINER_CFLAGS ${MAINTAINER_CFLAGS} " -DNUX_OPENGLES_20 -DUSE_GLES")
+endif (USE_GLES)
+
#
# GSettings Schema
#
diff --git a/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp b/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp
index ce5792da1..db43d7473 100644
--- a/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp
+++ b/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.cpp
@@ -438,13 +438,21 @@ UnityMTGrabHandlesWindow::getOutputExtents(CompWindowExtents& output)
bool
UnityMTGrabHandlesWindow::glDraw(const GLMatrix& transform,
+#ifdef USE_GLES
+ GLWindowPaintAttrib& attrib,
+#else
GLFragment::Attrib& fragment,
+#endif
const CompRegion& region,
unsigned int mask)
{
/* Draw the window on the bottom, we will be drawing the
* handles on top */
+#ifdef USE_GLES
+ bool status = gWindow->glDraw(transform, attrib, region, mask);
+#else
bool status = gWindow->glDraw(transform, fragment, region, mask);
+#endif
if (mHandles && mHandles->visible())
{
@@ -464,10 +472,17 @@ UnityMTGrabHandlesWindow::glDraw(const GLMatrix& transform,
GLTexture::MatrixList matl;
GLTexture::Matrix mat = tex->matrix();
CompRegion paintRegion(region);
+#ifdef USE_GLES
+ GLWindowPaintAttrib wAttrib(attrib);
+#endif
/* We can reset the window geometry since it will be
* re-added later */
+#ifdef USE_GLES
+ gWindow->vertexBuffer()->begin();
+#else
gWindow->geometry().reset();
+#endif
/* Not sure what this does, but it is necessary
* (adjusts for scale?) */
@@ -483,23 +498,35 @@ UnityMTGrabHandlesWindow::glDraw(const GLMatrix& transform,
* dim (so we get a nice render for things like
* wobbly etc etc */
gWindow->glAddGeometry(matl, reg, paintRegion);
-
+#ifdef USE_GLES
+ gWindow->vertexBuffer()->end();
+ wAttrib.opacity = mHandles->opacity();
+#else
/* Did it succeed? */
if (gWindow->geometry().vertices)
{
fragment.setOpacity(mHandles->opacity());
+#endif
/* Texture rendering set-up */
us->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->glDrawTexture(tex, fragment, mask | PAINT_WINDOW_BLEND_MASK
+ gWindow->glDrawTexture(tex,
+#ifdef USE_GLES
+ transform, wAttrib,
+#else
+ fragment,
+#endif
+ mask | PAINT_WINDOW_BLEND_MASK
| PAINT_WINDOW_TRANSLUCENT_MASK |
PAINT_WINDOW_TRANSFORMED_MASK);
/* Texture rendering tear-down */
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
us->gScreen->setTexEnvMode(GL_REPLACE);
+#ifndef USE_GLES
}
+#endif
}
handle++;
diff --git a/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.h b/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.h
index e10568ce0..a5a4e362e 100644
--- a/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.h
+++ b/plugins/unity-mt-grab-handles/src/unity-mt-grab-handles.h
@@ -229,7 +229,11 @@ public:
void moveNotify(int dx, int dy, bool immediate);
bool glDraw(const GLMatrix&,
+#ifdef USE_GLES
+ const GLWindowPaintAttrib&,
+#else
GLFragment::Attrib&,
+#endif
const CompRegion&,
unsigned int);
diff --git a/plugins/unitydialog/src/unitydialog.cpp b/plugins/unitydialog/src/unitydialog.cpp
index f2423fe90..b13a6f3be 100644
--- a/plugins/unitydialog/src/unitydialog.cpp
+++ b/plugins/unitydialog/src/unitydialog.cpp
@@ -420,7 +420,12 @@ UnityDialogWindow::glAddGeometry(const GLTexture::MatrixList& matrices,
/* Collect textures */
void
UnityDialogWindow::glDrawTexture(GLTexture* texture,
+#ifdef USE_GLES
+ const GLMatrix &transform,
+ const GLWindowPaintAttrib &attrib,
+#else
GLFragment::Attrib& fa,
+#endif
unsigned int mask)
{
unity::PaintInfoCollector::Active ()->processTexture (texture);
@@ -448,7 +453,11 @@ unity::GeometryCollection::addGeometryForWindow (CompWindow *w, const CompRegion
{
/* We can reset the window geometry since it will be
* re-added later */
+#ifdef USE_GLES
+ GLWindow::get (w)->vertexBuffer()->begin();
+#else
GLWindow::get (w)->geometry().reset();
+#endif
for (unsigned int i = 0; i < collectedMatrixLists.size (); i++)
{
@@ -462,6 +471,10 @@ unity::GeometryCollection::addGeometryForWindow (CompWindow *w, const CompRegion
* wobbly etc etc */
GLWindow::get (w)->glAddGeometry(matl, reg, paintRegion, min, max);
}
+
+#ifdef USE_GLES
+ GLWindow::get (w)->vertexBuffer()->end();
+#endif
}
void
@@ -497,7 +510,11 @@ unity::TexGeometryCollection::setTexture (GLTexture *tex)
}
void
-unity::TexGeometryCollection::addGeometriesAndDrawTextureForWindow(CompWindow *w, unsigned int mask)
+unity::TexGeometryCollection::addGeometriesAndDrawTextureForWindow(CompWindow *w,
+#ifdef USE_GLES
+ const GLMatrix &transform,
+#endif
+ unsigned int mask)
{
if (mTexture && mGeometries.status ())
{
@@ -509,6 +526,25 @@ unity::TexGeometryCollection::addGeometriesAndDrawTextureForWindow(CompWindow *w
mGeometries.addGeometryForWindow (w, paintRegion);
+#ifdef USE_GLES
+ UnityDialogScreen *uds = UnityDialogScreen::get (screen);
+ GLWindowPaintAttrib attrib (gWindow->lastPaintAttrib());
+ unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex();
+ /* Texture rendering set-up */
+// uds->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(mTexture, transform, attrib, 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);
+ uds->gScreen->setTexEnvMode(GL_REPLACE);
+#else
if (gWindow->geometry().vertices)
{
UnityDialogScreen *uds = UnityDialogScreen::get (screen);
@@ -528,6 +564,7 @@ unity::TexGeometryCollection::addGeometriesAndDrawTextureForWindow(CompWindow *w
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
uds->gScreen->setTexEnvMode(GL_REPLACE);
}
+#endif
}
}
@@ -581,10 +618,18 @@ unity::PaintInfoCollector::processTexture (GLTexture *tex)
}
void
-unity::PaintInfoCollector::drawGeometriesForWindow(CompWindow *w, unsigned int pm)
+unity::PaintInfoCollector::drawGeometriesForWindow(CompWindow *w,
+#ifdef USE_GLES
+ const GLMatrix &transform,
+#endif
+ unsigned int pm)
{
for (unity::TexGeometryCollection &tcg : mCollection)
+#if USE_GLES
+ tcg.addGeometriesAndDrawTextureForWindow (w, transform, pm);
+#else
tcg.addGeometriesAndDrawTextureForWindow (w, pm);
+#endif
}
unity::PaintInfoCollector * unity::PaintInfoCollector::active_collector = NULL;
@@ -599,7 +644,11 @@ unity::PaintInfoCollector::Active ()
bool
UnityDialogWindow::glDraw(const GLMatrix& transform,
+#ifdef USE_GLES
+ const GLWindowPaintAttrib& attrib,
+#else
GLFragment::Attrib& fragment,
+#endif
const CompRegion& region,
unsigned int mask)
{
@@ -610,7 +659,13 @@ UnityDialogWindow::glDraw(const GLMatrix& transform,
/* Draw the window on the bottom, we will be drawing the
* dim render on top */
- bool status = gWindow->glDraw(transform, fragment, region, mask);
+ bool status = gWindow->glDraw(transform,
+#ifdef USE_GLES
+ attrib
+#else
+ fragment,
+#endif
+ region, mask);
UNITY_DIALOG_SCREEN(screen);
@@ -618,10 +673,17 @@ UnityDialogWindow::glDraw(const GLMatrix& transform,
{
GLTexture::MatrixList matl;
GLTexture::Matrix mat = tex->matrix();
+#ifdef USE_GLES
+ GLWindowPaintAttrib wAttrib(attrib);
+#endif
/* We can reset the window geometry since it will be
* re-added later */
+#ifdef USE_GLES
+ gWindow->vertexBuffer()->begin();
+#else
gWindow->geometry().reset();
+#endif
/* Scale the dim render by the ratio of dim size
* to window size */
@@ -642,7 +704,28 @@ UnityDialogWindow::glDraw(const GLMatrix& transform,
* dim (so we get a nice render for things like
* wobbly etc etc */
gWindow->glAddGeometry(matl, reg, paintRegion);
-
+#ifdef USE_GLES
+ gWindow->vertexBuffer()->end();
+#endif
+
+#ifdef USE_GLES
+ unsigned int glDrawTextureIndex = gWindow->glDrawTextureGetCurrentIndex();
+ wAttrib.opacity = mShadeProgress;
+ /* Texture rendering set-up */
+// uds->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, attrib, 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);
+ uds->gScreen->setTexEnvMode(GL_REPLACE);
+#else
/* Did it succeed? */
if (gWindow->geometry().vertices)
{
@@ -662,6 +745,7 @@ UnityDialogWindow::glDraw(const GLMatrix& transform,
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
uds->gScreen->setTexEnvMode(GL_REPLACE);
}
+#endif
}
for (CompWindow* w : mTransients)
@@ -674,7 +758,11 @@ UnityDialogWindow::glDraw(const GLMatrix& transform,
unity::PaintInfoCollector pc (w);
pc.collect();
- pc.drawGeometriesForWindow (window, mask);
+ pc.drawGeometriesForWindow (window,
+#ifdef USE_GLES
+ transform,
+#endif
+ mask);
}
}
diff --git a/plugins/unitydialog/src/unitydialog.h b/plugins/unitydialog/src/unitydialog.h
index c57a99b5c..be3d785ac 100644
--- a/plugins/unitydialog/src/unitydialog.h
+++ b/plugins/unitydialog/src/unitydialog.h
@@ -64,7 +64,13 @@ namespace unity
int max);
void setTexture (GLTexture *);
+#ifdef USE_GLES
+ void addGeometriesAndDrawTextureForWindow (CompWindow *w,
+ const GLMatrix &transform,
+ unsigned int mask);
+#else
void addGeometriesAndDrawTextureForWindow (CompWindow *, unsigned int pm);
+#endif
private:
GLTexture* mTexture;
@@ -78,7 +84,13 @@ namespace unity
PaintInfoCollector (CompWindow *w);
void collect ();
+#ifdef USE_GLES
+ void drawGeometriesForWindow (CompWindow *w,
+ const GLMatrix &transform,
+ unsigned int pm);
+#else
void drawGeometriesForWindow (CompWindow *w, unsigned int pm);
+#endif
void processGeometry (const GLTexture::MatrixList &ml,
const CompRegion &r,
@@ -242,7 +254,12 @@ public:
public:
bool
- glDraw(const GLMatrix&, GLFragment::Attrib&,
+ glDraw(const GLMatrix&,
+#ifdef USE_GLES
+ const GLWindowPaintAttrib&,
+#else
+ GLFragment::Attrib&,
+#endif
const CompRegion&, unsigned int);
bool
@@ -258,7 +275,12 @@ public:
void
glDrawTexture(GLTexture* texture,
+#ifdef USE_GLES
+ const GLMatrix& transform,
+ const GLWindowPaintAttrib& attrib,
+#else
GLFragment::Attrib& attrib,
+#endif
unsigned int mask);