PDA

View Full Version : Qt vs. OpenGL pixel format



Caius Aérobus
14th April 2008, 11:44
More a recommandation for Qt developpers than a request for helping me.
Qt offers QImage::Format_ARGB32 pixel fomat while OpenGL supports RGBA format! Could be nice in the future that Qt offers QImage::Format_RGBA32 format!

jacek
14th April 2008, 22:29
Better send a suggestion to the Trolls.

firas
9th May 2008, 21:18
ahoy,
I think that OpenGL supports lots of formats to Draw or Read from the GPU color buffer, an example would be:


somewhere in the ctor:
QImage *pImg = new QImage(...);

...
then in
void QGLWidget::paintGL(){
glDrawPixels(pImg->width(), pImg->height(), GL_BGRA, GL_UNSIGNED_BYTE, pImg->bits());
}


Notice the GL_BGRA format you can change that to many other formats when passing QImage::bits() to glDrawPixels without the need to do QGLWidget::convertToGLFormat( buf ). The same holds for passing the GPU color bit buffer to the main process buffer when doing glReadPixels. Doing so increases the painting (rendering) performance by staggering 10-15 folds.

In brief adding more Image formats to QT is not bad idea but one may say it would be redundant.