summaryrefslogtreecommitdiffhomepage
path: root/src/rlgl.h
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2021-10-18 13:22:52 +0200
committerraysan5 <[email protected]>2021-10-18 13:22:52 +0200
commitb28e353626f0dba2155dd0d599c1109bb87d0dc1 (patch)
treeb130a9b7ae83204737e4f47b9986fe6bf8f0dcfc /src/rlgl.h
parenta3f9ba87046b494a7d08282049b8be807277121e (diff)
downloadraylib-b28e353626f0dba2155dd0d599c1109bb87d0dc1.tar.gz
raylib-b28e353626f0dba2155dd0d599c1109bb87d0dc1.zip
Reviewed `glDisableVertexAttribArray()` issue #2068
Diffstat (limited to 'src/rlgl.h')
-rw-r--r--src/rlgl.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/rlgl.h b/src/rlgl.h
index 14309e2f..1641ec15 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -2320,17 +2320,23 @@ void rlUnloadRenderBatch(rlRenderBatch batch)
{
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
// Unbind everything
- if (RLGL.ExtSupported.vao) glBindVertexArray(0);
- glDisableVertexAttribArray(0);
- glDisableVertexAttribArray(1);
- glDisableVertexAttribArray(2);
- glDisableVertexAttribArray(3);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
// Unload all vertex buffers data
for (int i = 0; i < batch.bufferCount; i++)
{
+ // Unbind VAO attribs data
+ if (RLGL.ExtSupported.vao)
+ {
+ glBindVertexArray(batch.vertexBuffer[i].vaoId);
+ glDisableVertexAttribArray(0);
+ glDisableVertexAttribArray(1);
+ glDisableVertexAttribArray(2);
+ glDisableVertexAttribArray(3);
+ glBindVertexArray(0);
+ }
+
// Delete VBOs from GPU (VRAM)
glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[0]);
glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[1]);