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:
...
then in
glDrawPixels(pImg->width(), pImg->height(), GL_BGRA, GL_UNSIGNED_BYTE, pImg->bits());
}
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());
}
To copy to clipboard, switch view to plain text mode
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.
Bookmarks