Hi all,
I'm developing a simple library that enable users to display raw buffers(RGB mainly) and overlays (text, squares ...). I already developed the "Qpainter" version, basically a derived QWidget that uses a Qpainter inside, for the overlays I had to save all the overlays painting requests by the client in temporary arrays and then paint over the buffer image in the paintEvent.

Qt Code:
  1. void DisplayPainter3::paintEvent(QPaintEvent *e)
  2. {
  3.  
  4. QPainter painter(this);
  5. painter.drawImage(QPoint(0, 0), newImage);
  6.  
  7. for (int i = 0; i < m_pxmps_list.size(); i++)
  8. {
  9. painter.drawPixmap(m_pxmps_list.at(i).p ,m_pxmps_list.at(i).px);
  10. }
  11.  
  12. for (i = 0; i < m_sq_list.size(); i++)
  13. {
  14. m_pen.setColor(m_sq_list.at(i).co);
  15. painter.setPen(m_pen);
  16. painter.drawRect(m_sq_list.at(i).xs, m_sq_list.at(i).ys, m_sq_list.at(i).w, m_sq_list.at(i).h);
  17. }
  18. ....
To copy to clipboard, switch view to plain text mode 

Now I'd like to do the same taking advantage of the OpenGl hardware acceleration, so my questions:

1. Is there some good tutorial on how using OpenGl for 2d painting in a QGLWidget (or some sample, the examples in Qt are all 3d )?
2. Should I use QGLPixelBuffer?
3. Would it be better to load the buffer in a QImage or Qpixmap before QGLWidget::renderPixmap()?

Ok, hoping not too be too off topic I thank you for any tips.

Bye