[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21379] branches/soc-2009-imbusy/source/ blender/gpu/intern/gpu_buffers.c: fixed a bug that caused the geometry to explode

Lukas Steiblys imbusy at imbusy.org
Mon Jul 6 10:57:37 CEST 2009


Revision: 21379
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21379
Author:   imbusy
Date:     2009-07-06 10:57:37 +0200 (Mon, 06 Jul 2009)

Log Message:
-----------
fixed a bug that caused the geometry to explode

Modified Paths:
--------------
    branches/soc-2009-imbusy/source/blender/gpu/intern/gpu_buffers.c

Modified: branches/soc-2009-imbusy/source/blender/gpu/intern/gpu_buffers.c
===================================================================
--- branches/soc-2009-imbusy/source/blender/gpu/intern/gpu_buffers.c	2009-07-06 03:44:44 UTC (rev 21378)
+++ branches/soc-2009-imbusy/source/blender/gpu/intern/gpu_buffers.c	2009-07-06 08:57:37 UTC (rev 21379)
@@ -58,10 +58,14 @@
 	DEBUG_VBO("GPU_buffer_pool_new\n");
 
 	if( useVBOs < 0 ) {
-		if( GL_ARB_vertex_buffer_object )
+		if( GL_ARB_vertex_buffer_object ) {
+			DEBUG_VBO( "Vertex Buffer Objects supported.\n" );
 			useVBOs = 1;
-		else
+		}
+		else {
+			DEBUG_VBO( "Vertex Buffer Objects NOT supported.\n" );
 			useVBOs = 0;
+		}
 	}
 
 	pool = MEM_callocN(sizeof(GPUBufferPool), "GPU_buffer_pool_new");
@@ -323,7 +327,7 @@
 
 	index = MEM_mallocN(sizeof(int)*object->nmaterials,"GPU_buffer_setup");
 	for( i = 0; i < object->nmaterials; i++ ) {
-		index[i] = object->materials[i].start;
+		index[i] = object->materials[i].start*3;
 		redir[object->materials[i].mat_nr+127] = i;
 	}
 
@@ -365,8 +369,13 @@
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
 	}
 	else {
-		varray = buffer->pointer;
-		(*copy_f)( dm, varray, index, redir, user );
+		if( buffer->pointer != 0 ) {
+			varray = buffer->pointer;
+			(*copy_f)( dm, varray, index, redir, user );
+		}
+		else {
+			dm->drawObject->legacy = 1;
+		}
 	}
 
 	MEM_freeN(index);





More information about the Bf-blender-cvs mailing list