[Qt-interest] viewing data from GPU in a QGraphicsView openGL widget

Cole, Derek dcole at integrity-apps.com
Wed Feb 23 23:02:08 CET 2011


Hello,

I am working on some code that I wrote a QT user interface for. I have had to use some code liek the following:

       QImage *qi = new QImage(imwidth, imheight, QImage::Format_RGB888);
    for (int h = 0; h<imheight; h++){
        memcpy(qi->scanLine(h), processedData[h], imwidth*3);
    }
    QList <QGraphicsItem *> itemList = scene.items();
    while(!itemList.isEmpty()){
        scene.removeItem(itemList.last());
        itemList.removeLast();
    }

    QPixmap p(QPixmap::fromImage(*qi,Qt::AutoColor));
     item = new ImagePixmapItem(p);
     scene.addItem(item);
     ui->graphicsView->setScene(&scene);
     ui->graphicsView->show();

Where processedData is an array that I returned from some code I developed in another library. It is simply an unsigned char** array. 

The processedData is in fact an array of data that is coming from a GPU kernel that I wrote in CUDA. 

Is there any way to get that data from the GPU to show up in my QGraphicsView without first having to copy it from the GPU back to the CPU, which sends it to the interface, which does that scanLine to get that data into a QImage, which then adds it to the scene, etc etc...

I was trying to find some examples of this perhaps happening via OpenGL, but I am not really sure where to look.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110223/4b10d124/attachment.html 


More information about the Qt-interest-old mailing list