png texture: set clamp mode if no mipmaps requested, and don't actually generate mips...

This commit is contained in:
Henrik Rydgard committed 2013-03-31 10:03:48 +02:00
1 parent 73177ff463
commit 22e648bb1a
1 file changed
+4 -2
+4 -2
View File
@@ -150,12 +150,14 @@ bool Texture::LoadPNG(const uint8_t *data, size_t size, bool genMips) {
return false;
}
GL_CHECK();
// TODO: should check for power of 2 tex size and disallow genMips when not.
glGenTextures(1, &id_);
glBindTexture(GL_TEXTURE_2D, id_);
SetTextureParameters(genMips ? ZIM_GEN_MIPS : 0);
SetTextureParameters(genMips ? ZIM_GEN_MIPS : ZIM_CLAMP);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width_, height_, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image_data);
glGenerateMipmap(GL_TEXTURE_2D);
if (genMips)
glGenerateMipmap(GL_TEXTURE_2D);
GL_CHECK();
free(image_data);
return true;