-
Notifications
You must be signed in to change notification settings - Fork 10
Description
I try to load a dds file, but when read the image data by following code
and convert save it to png format
` auto lr = dds.Load(dds_file.data(), dds_file.size());
if (tinyddsloader::Result::Success == lr) {
uint32_t w = dds.GetWidth();
uint32_t h = dds.GetHeight();
uint32_t c = dds.GetDepth();
uint32_t m = dds.GetMipCount();
uint32_t s = dds.GetArraySize();
sprintf(filename, "D:/crn/%s_%d.png", ndkey.path().c_str(), ndkey.epoch());
for (uint32_t arrayIdx = 0; arrayIdx < dds.GetArraySize(); arrayIdx++) {
for (uint32_t mipIdx = 0; mipIdx < dds.GetMipCount(); mipIdx++) {
const auto* imageData = dds.GetImageData(mipIdx, arrayIdx);
void* data = imageData->m_mem;
stbi_write_png(filename, w, h, c, data, 3* w * c);
}
}
}
however, the output png is mess up, not correct!
`