Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. How render native opengl and mix with QPainter on QwtPolarPlot?
Qt 6.11 is out! See what's new in the release blog

How render native opengl and mix with QPainter on QwtPolarPlot?

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
1 Posts 1 Posters 822 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sampad1370
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved