Skip to content

Commit

Permalink
UPBGE: Fix unbound VBO when updating data.
Browse files Browse the repository at this point in the history
Previously the VBO in VBO::UpdateData and VBO::UpdateIndices was not unbound.
It doesn't created any issue as everyon was binding it's VBO at the same target
(else for debug draw which in same case failed).

But with the support of VAO the bug was showed since the VAO undo the VBO only
bound in it and doesn't set a none VBO oustide.

To fix this bug the VBO are set to 0 in these both update data functions.
  • Loading branch information
panzergame committed Jun 8, 2016
1 parent c7fb446 commit 104b398
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ void VBO::UpdateData()
{
glBindBufferARB(GL_ARRAY_BUFFER_ARB, m_vbo_id);
glBufferData(GL_ARRAY_BUFFER, m_stride * m_size, m_data->m_vertex.data(), GL_STATIC_DRAW);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
}

void VBO::UpdateIndices()
{
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, m_ibo);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_data->m_index.size() * sizeof(GLuint),
m_data->m_index.data(), GL_STATIC_DRAW);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER, 0);
}

void VBO::SetMeshModified(RAS_IRasterizer::DrawType drawType, bool modified)
Expand Down

0 comments on commit 104b398

Please sign in to comment.