diff --git a/IO/src/ImageWriterKTX.cpp b/IO/src/ImageWriterKTX.cpp index 8c29972..20712f5 100644 --- a/IO/src/ImageWriterKTX.cpp +++ b/IO/src/ImageWriterKTX.cpp @@ -110,10 +110,12 @@ bool ImageWriterKTX::WriteImage() { wtr.Write(0x04030201); const char *orientationKey = "KTXorientation"; - const char *orientationValue = "S=r,T=u"; - const uint32 kvSz = - strlen(orientationKey) + 1 // key - + strlen(orientationValue) + 1; // value + uint32 oKeyLen = static_cast(strlen(orientationKey)); + + const char *orientationValue = "S=r,T=d"; + uint32 oValLen = static_cast(strlen(orientationValue)); + + const uint32 kvSz = oKeyLen + 1 + oValLen + 1; uint32 tkvSz = kvSz + 4; // total kv size tkvSz = (tkvSz + 3) & ~0x3; // 4-byte aligned @@ -153,8 +155,8 @@ bool ImageWriterKTX::WriteImage() { wtr.Write(1); // numberOfMipmapLevels wtr.Write(tkvSz); // total key value size wtr.Write(kvSz); // key value size - wtr.Write(orientationKey, strlen(orientationKey) + 1); // key - wtr.Write(orientationValue, strlen(orientationValue) + 1); // value + wtr.Write(orientationKey, oKeyLen + 1); // key + wtr.Write(orientationValue, oValLen + 1); // value wtr.Write(orientationKey, tkvSz - kvSz - 4); // padding if(ci && ci->GetFormat() == FasTC::eCompressionFormat_BPTC) {