[Interest] Antialiasing possible on QSGGeometry?

Mark markg85 at gmail.com
Fri Jun 7 00:12:45 CEST 2013


Hi,

Another day, another question :)
Don't worry, i plan on making a big blog about everything. This
information won't get lost.

So today i'm trying to draw a custom shape by setting vertices. More
specifically a GL_QUAD_STRIP.

It looks like this (obviously just testing data)
    QSGGeometry *geometry = new
QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), 8);
    geometry->setDrawingMode(GL_QUAD_STRIP);
    geometry->vertexDataAsPoint2D()[0].set(0, 100);
    geometry->vertexDataAsPoint2D()[1].set(0, height());
    geometry->vertexDataAsPoint2D()[2].set(width() / 4, 80);
    geometry->vertexDataAsPoint2D()[3].set(width() / 4, height());
    geometry->vertexDataAsPoint2D()[4].set(width() / 2, 110);
    geometry->vertexDataAsPoint2D()[5].set(width() / 2, height());
    geometry->vertexDataAsPoint2D()[6].set(width(), 150);
    geometry->vertexDataAsPoint2D()[7].set(width(), height());

    QSGFlatColorMaterial *material = new QSGFlatColorMaterial;
    material->setColor(QColor(255, 0, 0, 128));

    QSGGeometryNode *n = new QSGGeometryNode;
    n->setGeometry(geometry);
    n->setFlag(QSGNode::OwnsGeometry);
    n->setMaterial(material);
    n->setFlag(QSGNode::OwnsMaterial);

So roughly the same as the example [1] only with a quad strip.
However, this ends up looking a bit aliased.. So the question is: How
do i get this anti-aliased?

I did read something about multisampling and setting the number of
samples, but i can't find such a function in any of the used classes..

Kind regards,
Mark

[1] http://qt-project.org/doc/qt-5.0/qtquick/qsggeometrynode.html



More information about the Interest mailing list