More GLVertexBuffer work and preparations to use the new API

Review Request #110368 - Created May 8, 2013 and submitted - Latest diff uploaded

Fredrik Höglund
Add methods for mapping the vertex buffer directly, and do some cleanup in the functions
that build vertex arrays. This is done in preparation for making them use the new API,
but it also fixes bugs related to rectangular textures.

commit c2f627f05bd61619033b88cd8d1838de6971408f
Author: Fredrik Höglund <>
Date:   Tue Sep 11 18:13:27 2012 +0200

    kwin: Simplify WindowQuadList::makeArrays()
    Note that unlike the previous commit, this doesn't fix texture coordinates
    for rectangular textures. That case cannot be handled correctly without
    knowing the dimensions of the texture.

commit 3f7e158ec3b1aea88699b2477c3ae300e14dc8cf
Author: Fredrik Höglund <>
Date:   Sat Mar 16 12:38:17 2013 +0100

    kwin: Add more accessors in WindowVertex
    Reorder some of the methods and add new u() and v() accessors,
    which are aliases of textureX() and textureY().

commit 0d34a79600146367340c9d89c9f8b8d8d28a1d6a
Author: Fredrik Höglund <>
Date:   Tue Sep 11 18:04:30 2012 +0200

    kwin: Simplify makeDecorationArrays()
    This also fixes coordinate inversion for rectangular textures.

commit 7dee903d5e73231abf0fd9a85018da279000540c
Author: Fredrik Höglund <>
Date:   Thu Sep 27 21:22:05 2012 +0200

    kwin: Add GLTexture::matrix()
    This method returns a matrix that transforms normalized or un-normalized
    texture coordinates, taking the texture target and y-inversion flag into

commit f193e427cfcb1b4e896210fa29a9ef5f8066ea3c
Author: Fredrik Höglund <>
Date:   Fri Mar 15 13:53:57 2013 +0100

    kwin: Don't unbind vertex array buffers
    KWin always updates the array buffer binding before it calls GL functions
    that reference it, so there is never any need to reset it.
    This should eliminate half the calls to glBindBuffer() while painting
    the scene.

commit f80e61ebc55bd4d7fa60f174c2e443793c5f9658
Author: Fredrik Höglund <>
Date:   Mon Oct 29 21:21:42 2012 +0100

    kwin: Simplify the two setData() methods
    Simplify the two setData() methods in GLVertexBuffer by implementing
    them in terms of the new map() and unmap() methods.

commit f677676c43e0429894366863e4bc4c56129de3e8
Author: Fredrik Höglund <>
Date:   Wed Sep 26 17:17:09 2012 +0200

    kwin: Expose a map() and an unmap() method in GLVertexBuffer
    These methods make it possible to write directly into the buffer object
    when building vertex arrays.
    If the buffer object cannot be mapped, the map() method will return
    a pointer to local memory which will be submitted to the buffer object
    with glBufferData() when unmap() is called.