Hello,

I am currently using openGL to do my image drawing but I thought I would write a test program to see if I could use all QT instead. What I need to do is to display an image that is changing rapidly (up to 64 times a second). I was using glDrawPixels but once I started doing zooming and drawing lines on it, I started to have problems.

I am crashing deep in fillRect(rr.toRect(), &textureData, d); inside of QRasterPaintEngine::drawImage.

Am I approaching this wrong? Has anyone gotten this to work? I have put up a test string in the window and that appears so something can appear in my scene.

I have a class that gets created by my main.cpp and it looks like this:
Qt Code:
  1. imageTester::imageTester(QWidget *parent)
  2. : QWidget(parent)
  3. {
  4. ui.setupUi(this);
  5.  
  6. m_imageScene = new ImageScene();
  7.  
  8. m_view = new QGraphicsView(m_imageScene);
  9. m_view->show();
  10. }
To copy to clipboard, switch view to plain text mode 

Then my imageScene (derived from QGraphcisScene) starts up a timer in the constructor and when the timer goes off, it does the following:


Qt Code:
  1. if (m_pixmap != NULL) {
  2. removeItem(m_pixmap);
  3. delete m_pixmap;
  4. m_pixmap = NULL;
  5. }
  6. else {
  7. setSceneRect(0,0, w, h);
  8. }
  9.  
  10. unsigned char* displayBuffer = getBuffer();
  11.  
  12. // inside of getBuffer: displayBuffer = (unsigned char*) (malloc ((w*h) * 3));
  13. // and then filled with RGB values for w * h
  14.  
  15. if (displayBuffer != NULL) {
  16. QImage* image = new QImage(displayBuffer, w, h, QImage::Format_RGB32);
  17. QPixmap pixmap = QPixmap::fromImage(*image);
  18. m_pixmap = addPixmap(pixmap);
  19. m_pixmap->setVisible(true);
  20. update();
  21. free (displayBuffer);
  22. }
To copy to clipboard, switch view to plain text mode 

Side question: Can I free the image at the end of this method along with displayBuffer?

Thanks for any help.