diff --git a/src/cache.h b/src/cache.h index 4fbdc0c..f3d9509 100644 --- a/src/cache.h +++ b/src/cache.h @@ -686,7 +686,7 @@ struct WaterCache { int w, h; getTargetSize(w, h); // get refraction texture - if (!refract || w != refract->width || h != refract->height) { + if (!refract || w != refract->origWidth || h != refract->origHeight) { delete refract; refract = new Texture(w, h, Texture::RGBA, false); Core::setTarget(refract, CLEAR_ALL); diff --git a/src/mesh.h b/src/mesh.h index 81ded61..57cdf02 100644 --- a/src/mesh.h +++ b/src/mesh.h @@ -102,23 +102,26 @@ struct Mesh { if (Core::support.VAO) glBindVertexArray(Core::active.VAO = 0); - if (vertices || indices) { - glGenBuffers(2, ID); - bind(true); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, iCount * sizeof(Index), indices, GL_STATIC_DRAW); - glBufferData(GL_ARRAY_BUFFER, vCount * sizeof(VertexGPU), vertices, GL_STATIC_DRAW); - - if (Core::support.VAO && aCount) { - VAO = new GLuint[aCount]; - glGenVertexArrays(aCount, VAO); + #ifdef DYNGEOM_NO_VBO + if (!vertices && !indices) { + ID[0] = ID[1] = 0; + iBuffer = new Index[iCount]; + vBuffer = new VertexGPU[vCount]; + return; } - iBuffer = NULL; - vBuffer = NULL; - } else { - ID[0] = ID[1] = 0; - iBuffer = new Index[iCount]; - vBuffer = new VertexGPU[vCount]; + #endif + + glGenBuffers(2, ID); + bind(true); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, iCount * sizeof(Index), indices, GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, vCount * sizeof(VertexGPU), vertices, GL_STATIC_DRAW); + + if (Core::support.VAO && aCount) { + VAO = new GLuint[aCount]; + glGenVertexArrays(aCount, VAO); } + iBuffer = NULL; + vBuffer = NULL; #endif } diff --git a/src/texture.h b/src/texture.h index 4772ec5..04ea8f4 100644 --- a/src/texture.h +++ b/src/texture.h @@ -92,12 +92,15 @@ struct Texture { #endif #endif + origWidth = width; + origHeight = height; + if (!Core::support.texNPOT) { width = nextPow2(width); height = nextPow2(height); } - this->width = origWidth = width; - this->height = origHeight = height; + this->width = width; + this->height = height; bool filter = (opt & NEAREST) == 0; bool cube = (opt & CUBEMAP) != 0;