diff options
author | Germano <germano.costa@ig.com.br> | 2018-03-21 17:55:38 +0300 |
---|---|---|
committer | Germano <germano.costa@ig.com.br> | 2018-03-21 17:55:38 +0300 |
commit | 75c6119dc919d9769ef699c833a01b10ba01b75a (patch) | |
tree | 04b4323e7f14209c21c6f202da1addd216d95a84 /intern | |
parent | cac2415d829aca6f4d0b6f497c08c7d18efd5853 (diff) |
Fix: GWN Indexbuf creation was replacing the index buff bound to the last VAO
This led to problems such as the drawing of the navigate manipulator.
More details in the code comments.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/gawain/src/gwn_element.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/intern/gawain/src/gwn_element.c b/intern/gawain/src/gwn_element.c index 0b7dc675f87..c56516817d6 100644 --- a/intern/gawain/src/gwn_element.c +++ b/intern/gawain/src/gwn_element.c @@ -262,8 +262,11 @@ void GWN_indexbuf_build_in_place(Gwn_IndexBufBuilder* builder, Gwn_IndexBuf* ele elem->vbo_id = GWN_buf_id_alloc(); // send data to GPU - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elem->vbo_id); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, GWN_indexbuf_size_get(elem), builder->data, GL_STATIC_DRAW); + // GL_ELEMENT_ARRAY_BUFFER changes the state of the last VAO bound, + // so we use the GL_ARRAY_BUFFER here to create a buffer without + // interfering in the VAO state. + glBindBuffer(GL_ARRAY_BUFFER, elem->vbo_id); + glBufferData(GL_ARRAY_BUFFER, GWN_indexbuf_size_get(elem), builder->data, GL_STATIC_DRAW); // discard builder (one-time use) free(builder->data); |