The object that is constructed in the first line is completely overwritten by the copy in the second line. If there is more than one mipmap in the texture, the data object then contains too much data and the flipVertical function fails.
The commented-out lines would do the right thing by only copying the first mipmap rather than the whole img.imageData vector. Alternatively, the following code would also do the trick:
I'm not sure if the largest mipmap is always the first one, but at least for my test cases, it worked. If that is not the case in general, one would have to do something smarter here.
Sorry for not just providing a patch, I'm currently on Windows and things are painful.
The file bmdview.cpp contains the following piece of code for saving I8 format textures as TGA:
The object that is constructed in the first line is completely overwritten by the copy in the second line. If there is more than one mipmap in the texture, the data object then contains too much data and the flipVertical function fails.
The commented-out lines would do the right thing by only copying the first mipmap rather than the whole img.imageData vector. Alternatively, the following code would also do the trick:
I'm not sure if the largest mipmap is always the first one, but at least for my test cases, it worked. If that is not the case in general, one would have to do something smarter here.
Sorry for not just providing a patch, I'm currently on Windows and things are painful.