Hey Embers,
Anyone know of a way to turn a 2dpath into a vbo mesh? I’m trying to make an arc/bent line into a GL_Lines VBO mesh.
I’ve not yet spotted a staight-forward approach.
Cheers,
Gazoo
Hey Embers,
Anyone know of a way to turn a 2dpath into a vbo mesh? I’m trying to make an arc/bent line into a GL_Lines VBO mesh.
I’ve not yet spotted a staight-forward approach.
Cheers,
Gazoo
gl::VboMesh::create ( Triangulator { path2d }.calcMesh() );
Seems like it might spit out triangles as opposed to lines though? Worth a try
Failing that, you could try:
gl::BatchRef PathToBatch ( const Path2d& path, float approximationScale = 1.0f )
{
auto points = path.subdivide( approximationScale );
auto verts = gl::VertBatch ( GL_LINE_STRIP );
for ( auto& pt : points ) verts.vertex ( pt );
return gl::Batch::create ( verts, gl::getStockShader ( gl::ShaderDef().color() ) );
}
You’re a genius @lithium !