[Bf-blender-cvs] [6b21d22] blender2.8: Gawain: fix VAO and VBO binds

Mike Erwin noreply at git.blender.org
Sun Aug 7 07:07:19 CEST 2016


Commit: 6b21d22c6084a1820f4d82afc59583924076655b
Author: Mike Erwin
Date:   Sat Aug 6 21:49:30 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB6b21d22c6084a1820f4d82afc59583924076655b

Gawain: fix VAO and VBO binds

Immediate mode no longer leaves its internals bound after use. Part of
transition from a simple prototype app to non-simple Blender, which has
lots of other parts using OpenGL.

===================================================================

M	source/blender/gpu/intern/gpu_immediate.c

===================================================================

diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c
index 2e47630..1510809 100644
--- a/source/blender/gpu/intern/gpu_immediate.c
+++ b/source/blender/gpu/intern/gpu_immediate.c
@@ -201,7 +201,8 @@ void immInit()
 
 	imm.primitive = GL_NONE;
 	
-	// glBindBuffer(GL_ARRAY_BUFFER, 0);
+	glBindBuffer(GL_ARRAY_BUFFER, 0);
+	glBindVertexArray(0);
 	initialized = true;
 	}
 
@@ -257,7 +258,7 @@ void immBegin(GLenum primitive, unsigned vertex_ct)
 	assert(bytes_needed <= IMM_BUFFER_SIZE);
 #endif
 
-//	glBindBuffer(GL_ARRAY_BUFFER, imm.vbo_id);
+	glBindBuffer(GL_ARRAY_BUFFER, imm.vbo_id);
 
 	// does the current buffer have enough room?
 	const unsigned available_bytes = IMM_BUFFER_SIZE - imm.buffer_offset;
@@ -296,7 +297,7 @@ void immEnd()
 	glUnmapBuffer(GL_ARRAY_BUFFER);
 
 	// set up VAO -- can be done during Begin or End really
-//	glBindVertexArray(imm.vao_id);
+	glBindVertexArray(imm.vao_id);
 
 	const unsigned stride = immVertexFormat.stride;
 
@@ -334,7 +335,8 @@ void immEnd()
 
 	glDrawArrays(imm.primitive, 0, imm.vertex_ct);
 
-//	glBindVertexArray(0);
+	glBindBuffer(GL_ARRAY_BUFFER, 0);
+	glBindVertexArray(0);
 
 	// prep for next immBegin
 	imm.buffer_offset += imm.buffer_bytes_mapped;




More information about the Bf-blender-cvs mailing list