numberCruncher
numberCruncher

Reputation: 645

How to do Antialiasing on Custom QQuickItem with QSGGeometry

I created my own Custom QQuickItem which should draw a curve using QSGGeometry:

curve = new QSGGeometryNode;
curve->setFlag(QSGNode::OwnsMaterial,true);
curve->setFlag(QSGNode::OwnsGeometry,true);
curve->setGeometry(_geometry);

_geometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(),_xdata.size());
QSGGeometry::Point2D *points = _geometry->vertexDataAsPoint2D();
for(int i=0;i<_xdata.size();i++) {
    points[i].x = _xdata[i];
    points[i].y = _ydata[i];
}
_geometry->setLineWidth(2);
_geometry->setDrawingMode(GL_LINE_STRIP);
curve->setGeometry(_geometry);

How can I enable Anti-Aliasing for this curve?

Upvotes: 0

Views: 1075

Answers (1)

folibis
folibis

Reputation: 12864

Try this:

QQuickView view;
QSurfaceFormat format = view.format();
format.setSamples(16);
view.setFormat(format);
view->setSource("...");
view.show();

Upvotes: 2

Related Questions