//I start with a 24-bit bitmap raw-loaded into OpenGL
unsigned char * pixelData = new unsigned char * [4 * texture->GetWidth() * texture->GetHeight()];
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelData);
//Now I have a 32-bit texture loaded into memory...
QImage image
((uchar
*) pixelData, texture
->GetWidth
(), texture
->GetHeight
(),
QImage::Format_ARGB32);
delete [] pixelData;
image = image.rgbSwapped();
image = image.mirrored();
return QIcon(pixmap.
scaled(60,
60, Qt
::KeepAspectRatio, Qt
::SmoothTransformation));
//I start with a 24-bit bitmap raw-loaded into OpenGL
unsigned char * pixelData = new unsigned char * [4 * texture->GetWidth() * texture->GetHeight()];
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelData);
//Now I have a 32-bit texture loaded into memory...
QImage image((uchar *) pixelData, texture->GetWidth(), texture->GetHeight(), QImage::Format_ARGB32);
delete [] pixelData;
image = image.rgbSwapped();
image = image.mirrored();
QPixmap pixmap(QPixmap::fromImage(image));
return QIcon(pixmap.scaled(60, 60, Qt::KeepAspectRatio, Qt::SmoothTransformation));
To copy to clipboard, switch view to plain text mode
On the one hand, I'm a little disappointed that Qt has no way of handling raw 24-bit images... but on the other hand, I found that I didn't need to store my textures in memory if I can retrieve them from OGL easily
Bookmarks