<p>So after debugging some more, I've found that yes it is possible. You cam add buffers later on but they will need to point to their own attributes.</p>

<p>My issues came from thinking I could have multiple vbos contributing to a single attribute. That doesn't work. You need multiple vaos for that scenario.</p>

CC BY-SA 4.0
2019-04-09T09:37:58.847Z
What do you mean with "multiple vbos contributing to a single attribute"? This does *never* work, even with multiple VAOs this wouldn't work. A single attribute can only ever be sourced from a single VBO. So it seems you mean something different when you say "contributing to a single attribute". If you mean sourcing different attributes from different VBOs, this is very much possible, even with just a single VAO.
Christian Rau
CC BY-SA 4.0
2018-11-10T00:37:34.167Z
2018-11-10T00:37:34.167Z
scx
<p>Is it possible to add vbos to vbos after their creation? For example (pseudo-code):</p>

<pre><code>glGenVertexArrays(1, &amp;_vao);
glBindVertexArray(_vao);
// do init stuff
glBindVertexArray(0);

// Much much later in a galaxy far away
glBindVertexArray(_vao);
glGenBuffers(1, &amp;_instance_vbo);
glBindBuffer(GL_ARRAY_BUFFER, _instance_vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(blee), blee, GL_STATIC_DRAW);
glEnableVertexAttribArray(_vpos_att);
glVertexAttribPointer(_vpos_att, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);

// Draw
</code></pre>

<p>So far it hasn't really worked. Looking at the bound vbos to my vao (using <code>GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING</code>) shows no buffers bound. Though that may be another problem altogether.</p>

<opengl><vertex-buffer-object>
Adding vbos to a vao once it has been created
scx
# Adding vbos to a vao once it has been created

(Asked by: username_0 on 2018-11-09)

Is it possible to add vbos to vbos after their creation? For example (pseudo-code):
glGenVertexArrays(1, &_vao);
glBindVertexArray(_vao);
// do init stuff
glBindVertexArray(0);

// Much much later in a galaxy far away
glBindVertexArray(_vao);
glGenBuffers(1, &_instance_vbo);
glBindBuffer(GL_ARRAY_BUFFER, _instance_vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(blee), blee, GL_STATIC_DRAW);
glEnableVertexAttribArray(_vpos_att);
glVertexAttribPointer(_vpos_att, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);

// Draw

So far it hasn't really worked. Looking at the bound vbos to my vao (using GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) shows no buffers bound. Though that may be another problem altogether.

**Tags:** opengl, vertex-buffer-object

---

## 1 answers

### Answer by username_0 on 2018-11-10. Score: -1 | Accepted answer

So after debugging some more, I've found that yes it is possible. You cam add buffers later on but they will need to point to their own attributes.

My issues came from thinking I could have multiple vbos contributing to a single attribute. That doesn't work. You need multiple vaos for that scenario.

> **Comments:**
> **username_1**: What do you mean with "multiple vbos contributing to a single attribute"? This does *never* work, even with multiple VAOs this wouldn't work. A single attribute can only ever be sourced from a single VBO. So it seems you mean something different when you say "contributing to a single attribute". If you mean sourcing different attributes from different VBOs, this is very much possible, even with just a single VAO.  

---

