Align OpenGL textured integration baselines
This commit is contained in:
@@ -51,7 +51,7 @@ public:
|
||||
bool Initialize(OpenGLTextureType type, int width, int height, int depth, int mipLevels, OpenGLFormat format, const void* data = nullptr);
|
||||
bool Initialize2D(int width, int height, int channels, const void* data, bool generateMipmap = true);
|
||||
bool InitializeCubeMap(int size, int mipLevels, OpenGLFormat format, const void* data = nullptr);
|
||||
bool LoadFromFile(const char* path, bool flipVertical = true);
|
||||
bool LoadFromFile(const char* path, bool flipVertical = false);
|
||||
void Shutdown() override;
|
||||
|
||||
void Bind(int slot = 0) const;
|
||||
|
||||
@@ -121,13 +121,14 @@ bool OpenGLTexture::InitializeCubeMap(int size, int mipLevels, OpenGLFormat form
|
||||
bool OpenGLTexture::LoadFromFile(const char* path, bool flipVertical) {
|
||||
stbi_set_flip_vertically_on_load(flipVertical ? 1 : 0);
|
||||
|
||||
unsigned char* data = stbi_load(path, &m_width, &m_height, &m_channels, 0);
|
||||
unsigned char* data = stbi_load(path, &m_width, &m_height, &m_channels, STBI_rgb_alpha);
|
||||
if (!data) {
|
||||
std::cout << "Failed to load texture: " << path << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool result = Initialize2D(m_width, m_height, m_channels, data, true);
|
||||
m_channels = 4;
|
||||
bool result = Initialize2D(m_width, m_height, m_channels, data, false);
|
||||
stbi_image_free(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user