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:

        class Item :public QwtPolarItem
        {
         
         
        	void draw(QPainter *painter, const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
        						  const QPointF &pole, double radius, const QRectF &canvasRect)
        	{
        		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();
         
        		QMatrix mx;
        		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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.