mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-07 03:12:36 +01:00
TextureLoader now generate mipmaps
This commit is contained in:
parent
aa2ab80e60
commit
2474af6003
@ -64,13 +64,16 @@ bool TextureLoader::loadFromMemory(char *data)
|
|||||||
texNative.width, texNative.height, 0,
|
texNative.width, texNative.height, 0,
|
||||||
GL_BGRA, GL_UNSIGNED_BYTE, fullColor
|
GL_BGRA, GL_UNSIGNED_BYTE, fullColor
|
||||||
);
|
);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||||
|
|
||||||
|
glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
|
|
||||||
std::string name = std::string(texNative.diffuseName);
|
std::string name = std::string(texNative.diffuseName);
|
||||||
|
|
||||||
textures[name] = texture;
|
textures[name] = texture;
|
||||||
|
|
||||||
std::cout << "Loaded texture '" << name << "'" << std::endl;
|
// std::cout << "Loaded texture '" << name << "'" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -79,7 +82,7 @@ bool TextureLoader::loadFromMemory(char *data)
|
|||||||
void TextureLoader::bindTexture(std::string texture)
|
void TextureLoader::bindTexture(std::string texture)
|
||||||
{
|
{
|
||||||
if (textures.find(texture) == textures.end()) {
|
if (textures.find(texture) == textures.end()) {
|
||||||
std::cerr << "Could not find nor bind texture '" << texture << "'" << std::endl;
|
// std::cerr << "Could not find nor bind texture '" << texture << "'" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user