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.
Code:
{ for (int i = 0; i < m_pxmps_list.size(); i++) { painter.drawPixmap(m_pxmps_list.at(i).p ,m_pxmps_list.at(i).px); } for (i = 0; i < m_sq_list.size(); i++) { m_pen.setColor(m_sq_list.at(i).co); painter.setPen(m_pen); 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); } ....
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
