grabWidget is a costly method.
If I read your code's intent correctly you are:
- Creating a QPixmap using grabWidget()
- Converting the QPixmap to a PNG encoded data stream in a QByteArray
- Passing the QByteArray to another routine.
- Creating a QImage from the PNG encoded data stream
- Binding the QImage texture into a QGLWidget.
Perhaps I have missed something but steps 2 and 4 seem pointless. Why not just pass the QPixmap and call QGLWidget::bindTexture() on that? You avoid two costly conversions through PNG and the construction of a QImage.
Thanks for your idea. I tried it, but it had no effect in term of CPU reduction.
Bookmarks