Menu

#380 RenderAntialiased not doing the best thing

open
nobody
9
2025-06-24
2025-05-16
Anonymous
No

I have problem with curves, when plotting them they look not smooth even with:
curve->setRenderHint(QwtPlotItem::RenderAntialiased, true).
is there another way to make it smoother, when I zoom in the part that looks bad it looks better, I don't know why this problem happen

1 Attachments

Discussion

  • Uwe Rathmann

    Uwe Rathmann - 2025-05-18

    When having too many points to be displayed you can't expect to have much effect from antialiasing. Simply because it will result in many short lines. When zooming in you will have longer lines, where antialiasing will work.

    When approximating the curve points using QwtWeedingCurveFitter you probably will have better results. However the algo of th fitter is not very fast.

     
  • Marc Weichhold

    Marc Weichhold - 2025-06-11

    I second the concerns about jagged lines with Qwt 6.3.x while using an QwtPlotOpenGLCanvas. In the attachment there are two screenshots, the "good" one was created with Qwt 6.2.0 and Qt 5.14, the second one with Qwt 6.3.1 and Qt 5.14.

    Please note that the only difference is the different Qwt version, the code is exactly the same.

     
    • Uwe Rathmann

      Uwe Rathmann - 2025-06-16

      With OpenGL antialiasing is done by multisampling - setting QwtPlotItem::RenderAntialiased does not have an effect in this context.
      So your problem should be unrelated to the one of the initial report.

      Qwt 6.3 tries to initialize its internal FBO with the number of samples, that have been set
      for the canvas ( = QOpenGLWidget::format() ). If this value is 0 multisampling is disabled.

      I havn't checked how Qwt 6.2 did find its initial sample count but obviously it was different
      to what Qwt 6.3 is doing. However I do not want to revert the current behaviour as it would
      break other applications. Even worse - it has been reported that Qt 6.9 changed the behaviour of QOpenGLWidget in a way that breaks the detection of the sample count.

      So I recommend to set the sample count in your application explicitly:

      setCanvas( new QwtPlotOpenGLCanvas( sampleCount, ... ) );

       
  • Marc Weichhold

    Marc Weichhold - 2025-06-24

    That worked, thank you.

     

Anonymous
Anonymous

Add attachments
Cancel