テクスチャをロードする次のコードがあります。
PackageTexture AssetImporter::ProcessTexture(const boost::filesystem::path& assetPath, const TextureType textureType)
{
PackageTexture texture;
const std::string filename = assetPath.filename().string();
FREE_IMAGE_FORMAT imageFormat = FreeImage_GetFileType(filename.c_str());
if (imageFormat == FIF_UNKNOWN)
imageFormat = FreeImage_GetFIFFromFilename(filename.c_str());
if (imageFormat == FIF_UNKNOWN || !FreeImage_FIFSupportsReading(imageFormat))
return texture;
FIBITMAP* bitmap = FreeImage_Load(imageFormat, assetPath.string().c_str());
if (!bitmap || !FreeImage_GetBits(bitmap) || !FreeImage_GetWidth(bitmap) || !FreeImage_GetHeight(bitmap))
return texture;
FREE_IMAGE_COLOR_TYPE colorType = FreeImage_GetColorType(bitmap);
uint32_t bitsPerPixel = FreeImage_GetBPP(bitmap);
uint32_t widthInPixels = FreeImage_GetWidth(bitmap);
uint32_t heightInPixels = FreeImage_GetHeight(bitmap);
....
FreeImage_Unload(bitmap);
return texture;
}
問題は、「colorType」が間違った色のタイプを与えることです。たとえば、.jpg は rgb24 として報告されますが、それは bgr24 であり、BRGA32 である .dds 画像は RGBA32 として報告されます。ただし、.tga イメージは RGBA32 として正しく報告されます。
問題は何ですか?