# Why use multiple gl::VboMesh::layouts

**URL:** <https://discourse.libcinder.org/t/why-use-multiple-gl-vbomesh-layouts/942>\
**Category:** Using Cinder\
**Created:** [November 7, 2017, 1:07am UTC](https://discourse.libcinder.org/t/why-use-multiple-gl-vbomesh-layouts/942 "2017-11-07T01:07:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Craigson](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/craigson/32/43_2.png) [@Craigson](https://discourse.libcinder.org/u/Craigson)\
**Post date:** [November 7, 2017, 1:07am UTC](https://discourse.libcinder.org/t/why-use-multiple-gl-vbomesh-layouts/942/1 "2017-11-07T01:07:35Z")

</div>

Hi all,

Not so much a debugging question as a ‘why does this work this way’ question.

I’m getting some practise in by manually constructing geometry using a VboMesh ( the idea is to eventually create a cornell box).

I was stuck for a while before piecing together a solution from various forum posts, so now more of a question of ‘why’ it works that way…

```
// why the vector of layouts?
std::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::NORMAL, 3),
    gl::VboMesh::Layout().usage( GL_STATIC_DRAW ).attrib( geom::Attrib::TEX_COORD_0, 2 )

};

gl::VboRef ibo = gl::Vbo::create ( GL_ELEMENT_ARRAY_BUFFER, mIndices, GL_STATIC_DRAW );

mVbo = gl::VboMesh::create( (uint32_t)mPosCoords.size(), GL_TRIANGLES, {layout}, (uint32_t)mIndices.size(), GL_UNSIGNED_INT, ibo);

mVbo->bufferAttrib<vec3>(geom::Attrib::POSITION,mPosCoords);
mVbo->bufferAttrib<vec3>(geom::Attrib::NORMAL,mNormals);
mVbo->bufferAttrib<vec2>(geom::Attrib::TEX_COORD_0,mTexCoords);

```

As the comment at the top states… why do I need to pass a vector of VboMesh::Layouts to avoid getting a missing attribs error that was arising when I was chaining the attribs to a single Layout?

Thanks!

---

<div class="post-metadata">

**Author:** ![rich.e](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/rich.e/32/1025_2.png) [@rich.e](https://discourse.libcinder.org/u/rich.e)\
**Post date:** [December 25, 2017, 5:31am UTC](https://discourse.libcinder.org/t/why-use-multiple-gl-vbomesh-layouts/942/2 "2017-12-25T05:31:50Z")

</div>

Hey there,

Not sure if you moved past this as it was a while ago, but is it a question of terminology used? Each element in the layout vector represents how an attrib is laid out in memory. Maybe the confusing part is just that the ‘layout’ consists of `VboMesh:::Layout` objects?

Also not sure what it is you tried that was causing the gl error message.

cheers,  
Rich
