Skip to content

the imageData->m_mem is mess up #2

@manuel76413

Description

@manuel76413

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!
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions