# \[Solved\] 2dPath into VboMesh or Batch

**URL:** https://discourse.libcinder.org/t/solved-2dpath-into-vbomesh-or-batch/1852
**Category:** Using Cinder
**Created:** [August 20, 2021, 12:27pm UTC](https://discourse.libcinder.org/t/solved-2dpath-into-vbomesh-or-batch/1852 "2021-08-20T12:27:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Gazoo](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/gazoo/32/61_2.png) [@Gazoo](https://discourse.libcinder.org/u/Gazoo)
#### Post date: [August 20, 2021, 12:27pm UTC](https://discourse.libcinder.org/t/solved-2dpath-into-vbomesh-or-batch/1852/1 "2021-08-20T12:27:10Z")

</div>

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

---

<div class="post-metadata">

### Author: ![lithium](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/lithium/32/38_2.png) [@lithium](https://discourse.libcinder.org/u/lithium)
#### Post date: [August 20, 2021, 12:34pm UTC](https://discourse.libcinder.org/t/solved-2dpath-into-vbomesh-or-batch/1852/2 "2021-08-20T12:34:25Z")

</div>

```cpp
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:

```cpp
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() ) );
}

```

---

<div class="post-metadata">

### Author: ![Gazoo](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/gazoo/32/61_2.png) [@Gazoo](https://discourse.libcinder.org/u/Gazoo)
#### Post date: [August 21, 2021, 1:47am UTC](https://discourse.libcinder.org/t/solved-2dpath-into-vbomesh-or-batch/1852/3 "2021-08-21T01:47:59Z")

</div>

![Screenshot (46)](https://canada1.discourse-cdn.com/flex030/uploads/libcinder/original/1X/3d061aeec8e45032d9edf0e268e4b1a0649888ab.png)

You’re a genius @lithium ! 😃
