Parcourir la source

Bind array buffer when needed

Daniele Bartolini il y a 12 ans
Parent
commit
bd34ec0b3c
1 fichiers modifiés avec 5 ajouts et 3 suppressions
  1. 5 3
      engine/renderers/gl/GLRenderer.cpp

+ 5 - 3
engine/renderers/gl/GLRenderer.cpp

@@ -503,11 +503,13 @@ void GLRenderer::frame()
 		}
 		}
 
 
 		// Bind array buffers
 		// Bind array buffers
-		const VertexBufferId vb = cur_state.vb;
-
+		const VertexBufferId& vb = cur_state.vb;
 		if (vb.id != INVALID_ID)
 		if (vb.id != INVALID_ID)
 		{
 		{
 			const VertexBuffer& vertex_buffer = m_vertex_buffers[vb.index];
 			const VertexBuffer& vertex_buffer = m_vertex_buffers[vb.index];
+
+			glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer.m_id);
+
 			switch (vertex_buffer.m_format)
 			switch (vertex_buffer.m_format)
 			{
 			{
 				case VF_XY_FLOAT_32:
 				case VF_XY_FLOAT_32:
@@ -556,7 +558,7 @@ void GLRenderer::frame()
 			GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0));
 			GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0));
 		}
 		}
 
 
-		const IndexBufferId ib = cur_state.ib;
+		const IndexBufferId& ib = cur_state.ib;
 		if (ib.id != INVALID_ID)
 		if (ib.id != INVALID_ID)
 		{
 		{
 			const IndexBuffer& index_buffer = m_index_buffers[ib.index];
 			const IndexBuffer& index_buffer = m_index_buffers[ib.index];