Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect drawing with QNANO_USE_RENDERNODE #34

Open
ddobrev opened this issue Oct 14, 2018 · 1 comment
Open

Incorrect drawing with QNANO_USE_RENDERNODE #34

ddobrev opened this issue Oct 14, 2018 · 1 comment

Comments

@ddobrev
Copy link

ddobrev commented Oct 14, 2018

Let me start by expressing my gratitude to you for this excellent library. QQuickPaintedItem performs suboptimally, Shape renders poorly (seen in your example too), implementing updatePaintNode is difficult because of OpenGL, so an important niche remains which QNanoPainter fits in perfectly. I congratulate you.
Having said that, I have a problem. It's most probably a mistake of mine but I have so far been unable to find it. I have this painting code:

void RoundProgressPainter::paint(QNanoPainter* painter)
{
    painter->beginPath();
    painter->setStrokeStyle(m_color);
    painter->setLineWidth(m_penWidth);
    painter->setLineCap(QNanoPainter::LineCap::CAP_ROUND);
    painter->arc(width() / 2,
                 height() /  2,
                 (height() - m_penWidth) / 2,
                 0,
                 m_progress * 2 * M_PI / 100.0);
    painter->stroke();
}

Using it without QNANO_USE_RENDERNODE (correctly) gives me this:

qquickframebufferobject

Using it with QNANO_USE_RENDERNODE gives me this:

qrendernode

I have a feeling I am making a simple noob mistake so please help me. If necessary, I can provide the rest of my C++ as well as its usage in QML.

@QUItCoding
Copy link
Owner

Hi and thanks! =)

I tested by copying your sources into helloitem.h like this:

    HelloItemPainter()
        : m_color(255,0,0,255)
        , m_penWidth(10)
        , m_progress(90)
    {
    }

    void paint(QNanoPainter *p)
    {
        // Painting code is shared as it's identical in all hello* examples
        paintHelloItem(p, width(), height());

        p->beginPath();
        p->setStrokeStyle(m_color);
        p->setLineWidth(m_penWidth);
        p->setLineCap(QNanoPainter::LineCap::CAP_ROUND);
        p->arc(width() / 2,
               height() /  2,
               (height() - m_penWidth) / 2,
               0,
               m_progress * 2 * M_PI / 100.0);
        p->stroke();
    }

Building it with and without QNANO_USE_RENDERNODE look both like this:

helloitem_with_arc

So my guess is that either some other part of code is messing things up (which shouldn't happen if only change you do is QNANO_USE_RENDERNODE?) or your OpenGL drivers have a bug... Does the same happen on different system?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants