diff --git a/IO/src/ImageLoaderKTX.cpp b/IO/src/ImageLoaderKTX.cpp index 60d4ec1..50f3511 100644 --- a/IO/src/ImageLoaderKTX.cpp +++ b/IO/src/ImageLoaderKTX.cpp @@ -75,7 +75,7 @@ class ByteReader { { } bool Advance(uint32 nBytes) { - if(nBytes < m_BytesLeft) { + if(nBytes > m_BytesLeft) { assert(!"Cannot read any more, unexpected bytes!"); return false; } @@ -278,6 +278,7 @@ bool ImageLoaderKTX::ReadData() { switch(glInternalFormat) { case GL_COMPRESSED_RGBA_BPTC_UNORM: m_Format = FasTC::eCompressionFormat_BPTC; + break; default: fprintf(stderr, "KTX loader - texture format (0x%x) unsupported!\n", glInternalFormat); return false; diff --git a/IO/src/ImageWriterKTX.cpp b/IO/src/ImageWriterKTX.cpp index 20712f5..e9aa7e1 100644 --- a/IO/src/ImageWriterKTX.cpp +++ b/IO/src/ImageWriterKTX.cpp @@ -123,7 +123,7 @@ bool ImageWriterKTX::WriteImage() { if(ci) { wtr.Write(0); // glType wtr.Write(1); // glTypeSize - wtr.Write(GL_RGBA); // glFormat + wtr.Write(0); // glFormat must be zero for compressed images... switch(ci->GetFormat()) { case FasTC::eCompressionFormat_BPTC: wtr.Write(GL_COMPRESSED_RGBA_BPTC_UNORM); // glInternalFormat