Annotate plugin attempted to render multiple quads by using GL_TRIANGLE_STRIP, in a single render call. This produces unwanted triangles.
Convert it to assemble separate triangles. Signed-off-by: Pekka Paalanen <[email protected]> --- plugins/annotate/src/annotate.cpp | 63 ++++++++++++++++++++++++------------ 1 files changed, 42 insertions(+), 21 deletions(-) diff --git a/plugins/annotate/src/annotate.cpp b/plugins/annotate/src/annotate.cpp index 9e9bde5..29d6256 100644 --- a/plugins/annotate/src/annotate.cpp +++ b/plugins/annotate/src/annotate.cpp @@ -629,7 +629,7 @@ AnnoScreen::glPaintOutput (const GLScreenPaintAttrib &attrib, { GLVertexBuffer *streamingBuffer = GLVertexBuffer::streamingBuffer (); GLfloat vertexData[18]; - GLfloat textureData[8]; + GLfloat textureData[12]; CompRect rect; GLMatrix sTransform = transform; int numRect; @@ -651,42 +651,63 @@ AnnoScreen::glPaintOutput (const GLScreenPaintAttrib &attrib, tex->enable (GLTexture::Fast); - streamingBuffer->begin (GL_TRIANGLE_STRIP); + streamingBuffer->begin (GL_TRIANGLES); while (numRect--) { + GLfloat tx1 = COMP_TEX_COORD_X (tex->matrix (), + rect.at (pos).x1 ()); + GLfloat tx2 = COMP_TEX_COORD_X (tex->matrix (), + rect.at (pos).x2 ()); + GLfloat ty1 = COMP_TEX_COORD_Y (tex->matrix (), + rect.at (pos).y1 ()); + GLfloat ty2 = COMP_TEX_COORD_Y (tex->matrix (), + rect.at (pos).y2 ()); + vertexData[0] = rect.at (pos).x1 (); vertexData[1] = rect.at (pos).y1 (); vertexData[2] = 0.0f; + vertexData[3] = rect.at (pos).x1 (); vertexData[4] = rect.at (pos).y2 (); vertexData[5] = 0.0f; + vertexData[6] = rect.at (pos).x2 (); vertexData[7] = rect.at (pos).y1 (); vertexData[8] = 0.0f; - vertexData[9] = rect.at (pos).x2 (); + + vertexData[9] = rect.at (pos).x1 (); vertexData[10] = rect.at (pos).y2 (); vertexData[11] = 0.0f; - textureData[0] = COMP_TEX_COORD_X (tex->matrix (), - rect.at (pos).x1 ()); - textureData[1] = COMP_TEX_COORD_Y (tex->matrix (), - rect.at (pos).y1 ()); - textureData[2] = COMP_TEX_COORD_X (tex->matrix (), - rect.at (pos).x1 ()); - textureData[3] = COMP_TEX_COORD_Y (tex->matrix (), - rect.at (pos).y2 ()); - textureData[4] = COMP_TEX_COORD_X (tex->matrix (), - rect.at (pos).x2 ()); - textureData[5] = COMP_TEX_COORD_Y (tex->matrix (), - rect.at (pos).y1 ()); - textureData[6] = COMP_TEX_COORD_X (tex->matrix (), - rect.at (pos).x2 ()); - textureData[7] = COMP_TEX_COORD_Y (tex->matrix (), - rect.at (pos).y2 ()); + vertexData[12] = rect.at (pos).x2 (); + vertexData[13] = rect.at (pos).y2 (); + vertexData[14] = 0.0f; + + vertexData[15] = rect.at (pos).x2 (); + vertexData[16] = rect.at (pos).y1 (); + vertexData[17] = 0.0f; + + textureData[0] = tx1; + textureData[1] = ty1; + + textureData[2] = tx1; + textureData[3] = ty2; + + textureData[4] = tx2; + textureData[5] = ty1; + + textureData[6] = tx1; + textureData[7] = ty2; + + textureData[8] = tx2; + textureData[9] = ty2; + + textureData[10] = tx2; + textureData[11] = ty1; - streamingBuffer->addVertices (4, vertexData); - streamingBuffer->addTexCoords (0, 4, textureData); + streamingBuffer->addVertices (6, vertexData); + streamingBuffer->addTexCoords (0, 6, textureData); pos++; } -- 1.7.3.4 _______________________________________________ dev mailing list [email protected] http://lists.compiz.org/mailman/listinfo/dev
