PrivateGLScreen::paintBackground(): If background textures are empty,
fix the vertex array pointer to use the beginning of the vertex data
rather than (data + 2). Fix data allocation so only the necessary number
of vertices is allocated. Disable the unspecified texture coordinate
array in this case, since leaving it enabled may cause the GL driver to
segfault when attempting to dereference it.
---
plugins/opengl/src/paint.cpp | 30 ++++++++++++++++++++++--------
1 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/plugins/opengl/src/paint.cpp b/plugins/opengl/src/paint.cpp
index 21b2c11..ecdbdf5 100644
--- a/plugins/opengl/src/paint.cpp
+++ b/plugins/opengl/src/paint.cpp
@@ -92,15 +92,16 @@ PrivateGLScreen::paintBackground (const CompRegion ®ion,
backgroundLoaded = true;
}
- data = new GLfloat [nBox * 16];
- if (!data)
- return;
-
- d = data;
- n = nBox;
-
if (backgroundTextures.empty ())
{
+
+ data = new GLfloat [nBox * 8];
+ if (!data)
+ return;
+
+ d = data;
+ n = nBox;
+
while (n--)
{
*d++ = pBox->x1;
@@ -118,14 +119,27 @@ PrivateGLScreen::paintBackground (const CompRegion
®ion,
pBox++;
}
- glVertexPointer (2, GL_FLOAT, sizeof (GLfloat) * 2, data + 2);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+
+ glVertexPointer (2, GL_FLOAT, sizeof (GLfloat) * 2, data);
glColor4us (0, 0, 0, std::numeric_limits<unsigned short>::max ());
glDrawArrays (GL_QUADS, 0, nBox * 4);
glColor4usv (defaultColor);
+
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+
}
else
{
+
+ data = new GLfloat [nBox * 16];
+ if (!data)
+ return;
+
+ d = data;
+ n = nBox;
+
for (unsigned int i = 0; i < backgroundTextures.size (); i++)
{
GLTexture *bg = backgroundTextures[i];
--
1.7.1
_______________________________________________
dev mailing list
[email protected]
http://lists.compiz.org/mailman/listinfo/dev