VboMesh Quad with UV's


I’ve been through the VboMesh sample project and also read this (somewhat elderly) article on the basics of geometry with Cinder and I’m a still bit confused cos there’s quite a variation in the approach and syntax.

I would simply like to create a VBO consisting of two triangles to create a quad with UVs but there doesn’t seem to be anywhere that entirely documents the process of specifying the positions, indices, UVs and Color

At the moment I’m using the following, but I’d like to provide the vertex, indices and UV’s rather than using Plane():
gl::GlslProgRef shader = gl::GlslProg::create(loadAsset("shader.vert"), loadAsset("shader.frag")); geom::SourceMods quad = geom::Plane().subdivisions(vec2(1)); mShape = gl::Batch::create(quad, shader); ... mShape->draw();

Can anyone point me in the right direction?




you can find sample code here. It creates a high density planar mesh, similar to using geom::Plane, but done manually.


1 Like

Another way is to use a VertBatch.

gl::VertBatch verts ( GL_TRIANGLES );
verts.color(1, 0, 0);
verts.texCoord(0, 0);
verts.vertex(0, 0);
// ...
gl::BatchRef batch = gl::Batch::create ( verts, shader );

Thanks both, these seem to be exactly what I’m looking for, appreciate the help.