[Bf-blender-cvs] [16c7681] opensubdiv-modifier: OpenSubdiv: Resolve crash when opening user preferences

Sergey Sharybin noreply at git.blender.org
Fri Jul 25 09:55:17 CEST 2014


Commit: 16c76817052228d6ae8a2d3d7e952e4d490460d0
Author: Sergey Sharybin
Date:   Fri Jul 25 13:53:03 2014 +0600
Branches: opensubdiv-modifier
https://developer.blender.org/rB16c76817052228d6ae8a2d3d7e952e4d490460d0

OpenSubdiv: Resolve crash when opening user preferences

Was caused by wrong OpenGL state, now it should always be set
properly for osd mesh draw.

TODO: We might want to reshuffle all the ogl init functions to
make it look more pretty.

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

M	source/blender/blenkernel/intern/CCGSubSurf.c

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

diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 44cd5c8..b942f36 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -2390,8 +2390,6 @@ bool ccgSubSurf_prepareGLMesh(CCGSubSurf *ss, bool use_osd_glsl)
 		glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE,
 		                      sizeof(GLfloat) * 6, (float*)12);
 
-		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,
-		             openSubdiv_getOsdGLMeshPatchIndexBuffer(ss->osd_mesh));
 		glBindBuffer(GL_ARRAY_BUFFER, 0);
 	}
 	else if (ss->osd_coords_invalid) {
@@ -2410,12 +2408,16 @@ void ccgSubSurf_drawGLMesh(CCGSubSurf *ss, bool fill_quads,
                            int start_partition, int num_partitions)
 {
 	if (LIKELY(ss->osd_mesh != NULL)) {
+		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,
+		             openSubdiv_getOsdGLMeshPatchIndexBuffer(ss->osd_mesh));
+
 		openSubdiv_osdGLMeshBindVertexBuffer(ss->osd_mesh);
 		glBindVertexArray(ss->osd_vao);
 		openSubdiv_osdGLMeshDisplay(ss->osd_mesh, fill_quads,
 		                            start_partition, num_partitions);
 		glBindVertexArray(0);
 		glBindBuffer(GL_ARRAY_BUFFER, 0);
+		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
 	}
 }




More information about the Bf-blender-cvs mailing list