[Bf-blender-cvs] [75c6119dc91] blender2.8: Fix: GWN Indexbuf creation was replacing the index buff bound to the last VAO
Germano
noreply at git.blender.org
Wed Mar 21 15:55:56 CET 2018
Commit: 75c6119dc919d9769ef699c833a01b10ba01b75a
Author: Germano
Date: Wed Mar 21 11:55:38 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB75c6119dc919d9769ef699c833a01b10ba01b75a
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.
===================================================================
M intern/gawain/src/gwn_element.c
===================================================================
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);
More information about the Bf-blender-cvs
mailing list