[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44931] trunk/blender/source/blender/gpu/ intern/gpu_buffers.c: Fix for size of VBO index type when drawing multires in sculpt mode.

Nicholas Bishop nicholasbishop at gmail.com
Sat Mar 17 00:21:46 CET 2012


Revision: 44931
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44931
Author:   nicholasbishop
Date:     2012-03-16 23:21:40 +0000 (Fri, 16 Mar 2012)
Log Message:
-----------
Fix for size of VBO index type when drawing multires in sculpt mode.

The VBO index type can be either ushort or uint depending on the grid
size. The comparison was checking how many quads are in the array, but
this was incorrect; the size of the index elements should depend on
the maximum value they reference, i.e. the maximum coord/normal
element.

Modified Paths:
--------------
    trunk/blender/source/blender/gpu/intern/gpu_buffers.c

Modified: trunk/blender/source/blender/gpu/intern/gpu_buffers.c
===================================================================
--- trunk/blender/source/blender/gpu/intern/gpu_buffers.c	2012-03-16 23:01:37 UTC (rev 44930)
+++ trunk/blender/source/blender/gpu/intern/gpu_buffers.c	2012-03-16 23:21:40 UTC (rev 44931)
@@ -1572,7 +1572,7 @@
 
 		glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffer);
 
-		if(*totquad < USHRT_MAX) {
+		if(gridsize * gridsize < USHRT_MAX) {
 			*index_type = GL_UNSIGNED_SHORT;
 			FILL_QUAD_BUFFER(unsigned short, *totquad, buffer);
 		}
@@ -1617,7 +1617,7 @@
 
 			glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffers->index_buf);
 
-			if(totquad < USHRT_MAX) {
+			if(totgrid * gridsize * gridsize < USHRT_MAX) {
 				buffers->index_type = GL_UNSIGNED_SHORT;
 				FILL_QUAD_BUFFER(unsigned short, totquad, buffers->index_buf);
 			}




More information about the Bf-blender-cvs mailing list