how to rotate a bitmap image
opengl, qt, qt4, qt5
Solution
QImage srcImg(":/icon.png");
QPoint center = srcImg.rect().center();
QMatrix matrix;
matrix.translate(center.x(), center.y());
matrix.rotate(90);
QImage dstImg = srcImge.transformed(matrix);
QPixmap dstPix = QPixmap::fromImage(dstImg);
Problem
I receive 800 by 600 by 3 bitmap image and give as a parameter to glDrawPixels(). Before giving this to glDrawPixels, I want to rotate the bitmap by 90 degrees. is that possible? in case it was not a bitmap and instead an image like png, I would do the following: ``` QMatrix rm; rm.rotate(90); pixmap = pixmap.transformed(rm); pixmap.scaled(801, 701); texture = bindTexture(pixmap); ```