deform-effect: Use CoglPrimitives instead of CoglVertexBuffers
authorNeil Roberts <neil@linux.intel.com>
Tue, 8 Nov 2011 11:37:27 +0000 (11:37 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Tue, 15 Nov 2011 11:14:59 +0000 (11:14 +0000)
commit8a752d674b4b8711a3912ff18506bb13cf238034
treeea6ab4c3a6e1a12364f8d4bfc53a62fb3cb368eb
parentb281f2090a8fb042cb471611eab54c26ceba8074
deform-effect: Use CoglPrimitives instead of CoglVertexBuffers

This changes ClutterDeformEffect to use a CoglAttributeBuffer with a
CoglPrimitive instead of the old CoglVertexBuffer. The old vertex
buffer code is now implemented in terms of the attribute buffer code
and it will eventually be deprecated. Using CoglPrimitives should be
slightly more efficient.

This also changes the struct we store the vertices to be
CoglVertexP3T2C4 instead of CoglTextureVertex. The latter is
technically not compatible with neither vertex buffers nor attribute
buffers because it contains a CoglColor and the internal members of
that are private so it is not valid to assume it contains 4 bytes and
use that as an attribute. Also it contains padding so it ends up
redundantly creating a larger buffer. CoglTextureVertex is in the
public API for the deform_vertex virtual so we still have to maintain
that. Instead of directly manipulating the array to upload, the
application is now passed a stack allocated temporary struct which
gets converted to a CoglVertexP3T2C4. This also means that we can map
the buffer as write only and still let the application read-write the
vertex.

The paint debug code to draw line strips for the deform mesh was
previously trying to set a red source material. However this wasn't
working because the material color was being overwritten by the color
attribute in the vertex buffer. This patch fixes that by creating a
seperate primitive for the lines and not adding the color
attribute. The lines code was also drawing both the front and back
indices. I don't think that entirely makes sense so I've just changed
it to draw only the front indices. Maybe painting both would make more
sense if backface culling was still enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=663636
clutter/clutter-deform-effect.c