Hi, I'm new to Qt4. I'm currentl using Qt as part of my project, but I'm facing problem using it. My project consist of reading a raw image, and then display it.

Since my raw image is in short byte array, I can't seems to show the image correctly using QImage. However, I manage to get the image to output correctly with OpenGL glDrawPixels, but the process is kinda sluggish and eats quite a lot of resources. Since I just wanna show the image, I was searching for a better way.

Here's my OpenGL code.
Qt Code:
  1. void pktGLWidget::paintGL()
  2. {
  3. glClear(GL_COLOR_BUFFER_BIT);
  4. glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
  5. glDrawPixels(imgWidth, imgHeight, GL_LUMINANCE, GL_BYTE, glBuffer);
  6. glFlush();
  7. }
To copy to clipboard, switch view to plain text mode 

And here's my QImage code, which can't seems to work properly.
Qt Code:
  1. void pktQImage2D::processBuffer()
  2. {
  3. m_Image = QImage((uchar *) pixelData, imgWidth, imgHeight, QImage::Format_Mono);
  4. }
To copy to clipboard, switch view to plain text mode