[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38840] branches/soc-2011-cucumber/source/ gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp: VBOs now work properly with multiple UVs.

Daniel Stokes kupomail at gmail.com
Sat Jul 30 00:54:54 CEST 2011


Revision: 38840
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38840
Author:   kupoman
Date:     2011-07-29 22:54:53 +0000 (Fri, 29 Jul 2011)
Log Message:
-----------
VBOs now work properly with multiple UVs.

Modified Paths:
--------------
    branches/soc-2011-cucumber/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp

Modified: branches/soc-2011-cucumber/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
===================================================================
--- branches/soc-2011-cucumber/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp	2011-07-29 22:18:00 UTC (rev 38839)
+++ branches/soc-2011-cucumber/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp	2011-07-29 22:54:53 UTC (rev 38840)
@@ -50,7 +50,7 @@
 	// Generate Buffers
 	glGenBuffersARB(1, &this->vertex);
 	glGenBuffersARB(1, &this->normal);
-	glGenBuffersARB(2, this->UV);
+	glGenBuffersARB(RAS_TexVert::MAX_UNIT, this->UV);
 	glGenBuffersARB(1, &this->tangent);
 	glGenBuffersARB(1, &this->ibo);
 	glGenBuffersARB(1, &this->dummy);
@@ -126,7 +126,7 @@
 {
 	GLfloat* uvs;
 
-	int space = this->size*2*sizeof(GLfloat)*RAS_TexVert::MAX_UNIT;
+	int space = this->size*2*sizeof(GLfloat);
 
 	for (int uv=0; uv<RAS_TexVert::MAX_UNIT; ++uv)
 	{
@@ -246,6 +246,7 @@
 
 	if (GLEW_ARB_vertex_program)
 	{
+		int uv = 0;
 		for (int unit=0; unit<attrib_num; ++unit)
 		{
 			switch(attrib[unit])
@@ -257,7 +258,7 @@
 					glEnableVertexAttribArrayARB(unit);
 					break;
 				case RAS_IRasterizer::RAS_TEXCO_UV:
-					glBindBufferARB(GL_ARRAY_BUFFER_ARB, this->UV[unit-1]);
+					glBindBufferARB(GL_ARRAY_BUFFER_ARB, this->UV[uv++]);
 					glVertexAttribPointerARB(unit, 2, GL_FLOAT, GL_FALSE, 0, 0);
 					glEnableVertexAttribArrayARB(unit);
 					break;




More information about the Bf-blender-cvs mailing list