How render native opengl and mix with QPainter on QwtPolarPlot?
Hi
I need to mixed shader render opengl with QPainter that render on QwtPolarPlot that is inside of draw function of QwtPolarItem!!!
but how can do this?
I do that but don't see anything with follow code:
Code:
class Item :public QwtPolarItem
{
{
Q_UNUSED(center);
Q_UNUSED(elapsed);
painter->scale(0.1, 0.1);
painter->setPen(...);
painter
->setRenderHint
(QPainter::HighQualityAntialiasing);
painter->drawPie(...);
painter->setPen(...);
painter->drawEllipse(...);
painter->setPen(...);
painter->drawLine(...);
painter->setPen(...);
painter->drawEllipse(...);
painter->save();
mx.reset();
painter->setMatrix(mx);
painter->beginNativePainting();
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
//glTranslatef(center.x(), center.y(), 0);
glColor3b(255, 255, 255);
glBegin(GL_LINES);
glVertex2d(0, 0);
glVertex2d(100, 0);
glVertex2d(0, 100);
glVertex2d(100, 100);
glEnd();
glFlush();
painter->endNativePainting();
painter->restore();
}
...
}
Also I know some mistake for example don't set clear color and clear color buffer and flush buffer.
Also I must render first painter then opengl.
please answer me for this code and typical way to render and please say any problem you see in my code.
thanks.
Re: How render native opengl and mix with QPainter on QwtPolarPlot?
QwtPolarPlot is no QOpenGLWidget, so all you can do is to render to an FBO, translate it to an QImage and then draw the image.
But converting a FBO into a QImage is an expensive operation and such a setup won't be the right setup if you need very high refresh rates.
Uwe
Re: How render native opengl and mix with QPainter on QwtPolarPlot?
thanks @Uwe
but I need to realtime and hight refresh rate so Do you say no any way to do that work in default render function qwtpolarItem?
because QPainter is using opengl in background so should have a way for do this work,but why can't? :crying: