# Adjacency to index buffer from trimesh

**URL:** <https://discourse.libcinder.org/t/adjacency-to-index-buffer-from-trimesh/163>\
**Category:** Using Cinder\
**Created:** [July 19, 2016, 9:40pm UTC](https://discourse.libcinder.org/t/adjacency-to-index-buffer-from-trimesh/163 "2016-07-19T21:40:43Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![paul.houx](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/paul.houx/32/31_2.png) [@paul.houx](https://discourse.libcinder.org/u/paul.houx)\
**Post date:** [July 19, 2016, 11:20pm UTC](https://discourse.libcinder.org/t/adjacency-to-index-buffer-from-trimesh/163/2 "2016-07-19T23:20:39Z")

</div>

Hi,

a `TriMesh`, by default, is not really suitable for that kind of thing. It only supports `GL_TRIANGLES`, meaning that for each triangle there are 3 indices in the index buffer. There is no adjacency information available, because this is not stored in an OBJ file, anyway.

The way I see it you have 2 options:

1. Create your own mesh from scratch.
2. Parse the `TriMesh` one triangle at a time and try to reconstruct adjacency info from it. If two triangles share two vertices, you know they are adjacent to each other. Then build a new index buffer and set the primitive type to `GL_TRIANGLES_ADJACENCY`.

-Paul

---

_[View the full topic](https://discourse.libcinder.org/t/adjacency-to-index-buffer-from-trimesh/163)._
