Fix red textures being distorted

Signed-off-by: Alexis Maiquez <almamu@almamu.com>
This commit is contained in:
Alexis Maiquez 2022-11-01 05:04:06 +01:00
parent 7e6cb9a458
commit e377960a87

View File

@ -42,7 +42,6 @@ CTexture::CTexture (void* fileData)
this->m_header->width, this->m_header->height this->m_header->width, this->m_header->height
}; };
} }
} }
if (this->m_header->freeImageFormat != FREE_IMAGE_FORMAT::FIF_UNKNOWN) if (this->m_header->freeImageFormat != FREE_IMAGE_FORMAT::FIF_UNKNOWN)
@ -163,8 +162,12 @@ CTexture::CTexture (void* fileData)
if (this->m_header->format == TextureFormat::RG88) if (this->m_header->format == TextureFormat::RG88)
textureFormat = GL_RG; textureFormat = GL_RG;
else if (this->m_header->format == TextureFormat::R8) else if (this->m_header->format == TextureFormat::R8)
{
// red textures are 1-byte-per-pixel, so it's alignment has to be set manually
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
textureFormat = GL_RED; textureFormat = GL_RED;
} }
}
switch (internalFormat) switch (internalFormat)
{ {