From 79fed1e954ce77fabb2f09573e2fcd00d6326cef Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Thu, 2 May 2019 17:49:10 -0400 Subject: [PATCH] Unbind VBO from model during mid-frame --- src/hardware/r_opengl/r_opengl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 2dba9980a..5caa31e29 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1632,6 +1632,10 @@ static void CreateModelVBO(mesh_t *mesh, mdlframe_t *frame) pglBindBuffer(GL_ARRAY_BUFFER, frame->vboID); pglBufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_STATIC_DRAW); free(buffer); + + // Don't leave the array buffer bound to the model, + // since this is called mid-frame + pglBindBuffer(GL_ARRAY_BUFFER, 0); } static void CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame) @@ -1673,6 +1677,11 @@ static void CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame) pglBindBuffer(GL_ARRAY_BUFFER, frame->vboID); pglBufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_STATIC_DRAW); free(buffer); + + // Don't leave the array buffer bound to the model, + // since this is called mid-frame + pglBindBuffer(GL_ARRAY_BUFFER, 0); +} } EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)