0
\$\begingroup\$

I use standard android tool for compressing PNG texture and archiving it with gzip:

/android-sdks/tools/etc1tool texture.png --encodeNoHeader
gzip texture.pkm

Then I try to load it:

FileHandle file = ...;
ETC1.ETC1Data data = new ETC1.ETC1Data(file);
ETC1TextureData td = new ETC1TextureData(data, false);
Texture texture = new Texture(td);

But I get an java.nio.BufferOverflowException inside ETC1Data (FileHandle pkmFile) constructor:

  in = new DataInputStream(new BufferedInputStream(new GZIPInputStream(pkmFile.read())));
  int fileSize = in.readInt();
  compressedData = BufferUtils.newUnsafeByteBuffer(fileSize);
  int readBytes = 0;
  while ((readBytes = in.read(buffer)) != -1) {
      compressedData.put(buffer, 0, readBytes);//Exception occurs here
  }
  compressedData.position(0);
  compressedData.limit(compressedData.capacity());

How to fix it? Thanks.

ps if it's important: unarchived pkm file size is 33KB

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

Standard tool from Google is not suitable for compression. But ETC1Compressor works fine.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .