dungeon_crawler

changeset 27:cbf86e5198a9

fized the vbo state creep
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 25 Aug 2012 14:37:51 +0300
parents 21999ef6636b
children f5fb04fe12cd
files prototype/src/light.cc prototype/src/mesh.cc
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/prototype/src/light.cc	Sat Aug 25 04:07:51 2012 +0300
     1.2 +++ b/prototype/src/light.cc	Sat Aug 25 14:37:51 2012 +0300
     1.3 @@ -46,6 +46,7 @@
     1.4  
     1.5  	glDrawArrays(GL_TRIANGLES, 0, num_faces * 3);
     1.6  
     1.7 +	glBindBuffer(GL_ARRAY_BUFFER, 0);
     1.8  	glDisableClientState(GL_VERTEX_ARRAY);
     1.9  }
    1.10  
    1.11 @@ -164,6 +165,7 @@
    1.12  		}
    1.13  	}
    1.14  	glUnmapBuffer(GL_ARRAY_BUFFER);
    1.15 +	glBindBuffer(GL_ARRAY_BUFFER, 0);
    1.16  	return true;
    1.17  }
    1.18  
     2.1 --- a/prototype/src/mesh.cc	Sat Aug 25 04:07:51 2012 +0300
     2.2 +++ b/prototype/src/mesh.cc	Sat Aug 25 14:37:51 2012 +0300
     2.3 @@ -77,6 +77,8 @@
     2.4  		}
     2.5  	}
     2.6  	glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
     2.7 +	glBindBuffer(GL_ARRAY_BUFFER, 0);
     2.8 +	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
     2.9  	return true;
    2.10  }
    2.11  
    2.12 @@ -165,6 +167,8 @@
    2.13  		glDisableVertexAttribArray(tang_loc);
    2.14  	}
    2.15  
    2.16 +	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
    2.17 +
    2.18  #ifdef DBG_NORMALS
    2.19  	glPushAttrib(GL_ENABLE_BIT);
    2.20  	glDisable(GL_LIGHTING);
    2.21 @@ -199,6 +203,8 @@
    2.22  	glPopAttrib();
    2.23  #endif
    2.24  
    2.25 +	glBindBuffer(GL_ARRAY_BUFFER, 0);
    2.26 +
    2.27  	glPopMatrix();
    2.28  }
    2.29