Hi,
it’s been a while since I used Cinder and it looks like many things have changed.
I’m trying to construct a vbo manually, but I must be doing something wrong as I can’t see anything on screen. Regardless the actual geometry(random points atm) I’m creating a simple vbo with static points, indices and colors.
const int numVerts = 9;
std::vector<vec3> positions;
std::vector<ColorA> colors;
std::vector<uint32_t> indices;
for( size_t k=0; k < numVerts; k++ )
{
indices.push_back( k );
positions.push_back( vec3( randFloat(-10.0f, 10.0f), randFloat(-10.0f, 10.0f), randFloat(-10.0f, 10.0f) ) );
colors.push_back( ColorA(1.0,0.0,0.0,1.0) );
}
vector<gl::VboMesh::Layout> layout = {
gl::VboMesh::Layout().usage( GL_STATIC_DRAW ).attrib( geom::Attrib::POSITION, 3 ),
gl::VboMesh::Layout().usage( GL_STATIC_DRAW ).attrib( geom::Attrib::COLOR, 4 )
};
mVboMesh = gl::VboMesh::create( numVerts, GL_TRIANGLES, { layout }, numVerts );
mVboMesh->bufferAttrib<vec3>( geom::POSITION, positions );
mVboMesh->bufferAttrib<ColorA>( geom::COLOR, colors );
mVboMesh->bufferIndices( numVerts, indices.data() );
mBatch = gl::Batch::create( mVboMesh, gl::getStockShader( gl::ShaderDef().color() ) );
this is my draw()
gl::ScopedGlslProg scpGlslProg(gl::getStockShader(gl::ShaderDef().color()));
gl::draw( mVboMesh );
OR
mBatch->draw();