- attempt to better handler tomreyn's fuzzer.

This commit is contained in:
Mark Vejvoda
2011-01-12 06:52:03 +00:00
parent 26a382bd64
commit 6bfc4d7c2e

View File

@@ -35,7 +35,7 @@ ModelRendererGl::ModelRendererGl(){
void ModelRendererGl::begin(bool renderNormals, bool renderTextures, bool renderColors, MeshCallback *meshCallback) { void ModelRendererGl::begin(bool renderNormals, bool renderTextures, bool renderColors, MeshCallback *meshCallback) {
//assertions //assertions
assert(!rendering); assert(rendering == false);
assertGl(); assertGl();
this->renderTextures= renderTextures; this->renderTextures= renderTextures;
@@ -151,12 +151,16 @@ void ModelRendererGl::renderMesh(const Mesh *mesh){
if(texture != NULL && renderTextures) { if(texture != NULL && renderTextures) {
if(lastTexture != texture->getHandle()){ if(lastTexture != texture->getHandle()){
//assert(glIsTexture(texture->getHandle())); //assert(glIsTexture(texture->getHandle()));
if(glIsTexture(texture->getHandle()) == false) { //throw runtime_error("glIsTexture(texture->getHandle()) == false for texture: " + texture->getPath());
throw runtime_error("glIsTexture(texture->getHandle()) == false for texture: " + texture->getPath()); if(glIsTexture(texture->getHandle()) == true) {
}
glBindTexture(GL_TEXTURE_2D, texture->getHandle()); glBindTexture(GL_TEXTURE_2D, texture->getHandle());
lastTexture= texture->getHandle(); lastTexture= texture->getHandle();
} }
else {
glBindTexture(GL_TEXTURE_2D, 0);
lastTexture= 0;
}
}
} }
else{ else{
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);