Unbind VBO from model during mid-frame

This commit is contained in:
Jaime Passos 2019-05-02 17:49:10 -04:00 committed by mazmazz
parent 3d90488d17
commit 79fed1e954

View file

@ -1632,6 +1632,10 @@ static void CreateModelVBO(mesh_t *mesh, mdlframe_t *frame)
pglBindBuffer(GL_ARRAY_BUFFER, frame->vboID); pglBindBuffer(GL_ARRAY_BUFFER, frame->vboID);
pglBufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_STATIC_DRAW); pglBufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_STATIC_DRAW);
free(buffer); 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) 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); pglBindBuffer(GL_ARRAY_BUFFER, frame->vboID);
pglBufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_STATIC_DRAW); pglBufferData(GL_ARRAY_BUFFER, bufferSize, buffer, GL_STATIC_DRAW);
free(buffer); 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) EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)