I have about six files, each 250 KB to 500 KB. Each of these files have multiple QImages in them; each file about 400 images of 128x64. Loading is about 60MB/s to memory (seeing as OpenGL needs to unpack PNG's to it's own format).
Is it possible to speed this process up? It's painstakingly slow as I have about a gig to fill.
QFile file("file.ucv");
if (file.open(QIODevice::ReadOnly)) {
qDebug() << "Read from hdd";
QDataStream r(&file);
r.setVersion(QDataStream::Qt_4_3);
QImage t;
int i = maxPics * place;
glGenTextures(maxPics, &texture[i]);
for (int y = 0; y < yNrPics; y++)
for (int x = 0; x < xNrPics; x++, i++) {
// Write to precomputed object
r >> t;
glBindTexture( GL_TEXTURE_2D, texture[i] );
glTexImage2D( GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA, t.width(), t.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, t.bits() );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
}
The profiler finds this line to be the most consumptious:
glTexImage2D( GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA, t.width(), t.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, t.bits() );
Changing compressed to noncompressed, saves some time, but still not much.
The loaded QImage is in GLformat.