mirror of
https://github.com/Linloir/SceneEditor.git
synced 2025-12-17 15:38:11 +08:00
[CORE][CHG] Add logger in texture loader
This commit is contained in:
parent
b2bcba75ea
commit
aeaac1833f
@ -34,19 +34,22 @@ Texture::Texture(TextureType type, std::string path) {
|
|||||||
if (data) {
|
if (data) {
|
||||||
GLenum format;
|
GLenum format;
|
||||||
if (nrChannels == 1) {
|
if (nrChannels == 1) {
|
||||||
|
Logger::debug("Texture " + _path + " is a grayscale image");
|
||||||
format = GL_RED;
|
format = GL_RED;
|
||||||
}
|
}
|
||||||
else if (nrChannels == 3) {
|
else if (nrChannels == 3) {
|
||||||
|
Logger::debug("Texture " + _path + " is a RGB image");
|
||||||
format = GL_RGB;
|
format = GL_RGB;
|
||||||
}
|
}
|
||||||
else if (nrChannels == 4) {
|
else if (nrChannels == 4) {
|
||||||
|
Logger::debug("Texture " + _path + " is a RGBA image");
|
||||||
format = GL_RGBA;
|
format = GL_RGBA;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Logger::error("Unexpected channel count");
|
Logger::error("Unexpected channel count");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OPENGL_FUNCTIONS->glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);
|
OPENGL_FUNCTIONS->glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data);
|
||||||
OPENGL_FUNCTIONS->glGenerateMipmap(GL_TEXTURE_2D);
|
OPENGL_FUNCTIONS->glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user