mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-15 02:29:51 +01:00
png texture: set clamp mode if no mipmaps requested, and don't actually generate mips...
This commit is contained in:
1 parent
73177ff463
commit
22e648bb1a
1 file changed
+4
-2
+4
-2
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user