I'm triying to make a 2D real-time plot. I've tried with modifying the osciloscope example of qwt, tried to use QGraphicsView, and QPainter to reach high framerate drawing. I'm using 8 channels to plot data wich is arriving from a rs232 port. I take a sample every 10 ms. Maybe i've used the QPainter in a wrong way, but i couldn't draw very fast. With the qwt example, in wich doesn't update the whole screen the drawing speed was good, especially in X11 with Qt::WA_PaintOutsidePaintEvent and Qt::WA_PaintOnScreen.
Now i'm subclassing the QGLWidget, and i'm reaching a acceptable speed. But i'm wondering if i could improve it.
Every time I recived a new point i stored it, and the call updateGL(); In this case i recived only the y coordinate, buth i'm going to recive the whole pair.
void Plot::addPoint(int y)
{
points[t].x=t;
points[t].y=y;
t++;
updateGL();
}
In DrawGL() i check if the line reach the end of the screen, if is True i erase the screen if not, i draw only the the new part of the line.
glBegin(GL_LINES);
glVertex2i( points[t-1].x, points[t-1].y);
glVertex2i( points[t-2].x, points[t-2].y);
glEnd();
I've disabled the Dithering and multisampling, and i'm using flat shades. i'm using an ortographic projection.
is there some way to draw faster? maybe using opengl for off-screen drawing and the showing the corresponding pixmap? is the a project similar to this?