[Interest] Drawing dashed line with QSGSimpleMaterialShader

Artem Fedoskin afedoskin3 at gmail.com
Tue Jun 14 12:29:54 CEST 2016


Hi Gunnar,

Thank you for you response.

>> You can set the texture's filtering to QSGTexture::Linear to make use
bilinear sampling to minimize much of these,

I tried it but it didn't help a lot.

>> but if you want it "perfect" you will have to rasterize the source image
in device coordinates rather than logical ones.

Could you please tell me how can I do that? Should I translate coordinates
of QPainter?

Regards, Artem




2016-06-14 9:39 GMT+02:00 Gunnar Sletta <gunnar at sletta.org>:

> When you rotate or scale a texture it will no longer align with the
> destination pixels perfectly, so you some artifacts expected. You can set
> the texture's filtering to QSGTexture::Linear to make use bilinear sampling
> to minimize much of these, but if you want it "perfect" you will have to
> rasterize the source image in device coordinates rather than logical ones.
>
> cheers,
> Gunnar
>
> > On 13 Jun 2016, at 22:37, Artem Fedoskin <afedoskin3 at gmail.com> wrote:
> >
> > Thank you guys for all your advices.
> >
> > I implemented the thing I need by drawing textures with QPainter but
> whenever I rotate my QQuickItem using setRotation() or rotate the transform
> matrix the texture is displayed incorrectly.
> >
> > This is the correct way of displaying - http://i.imgur.com/bZIsWHR.png
> > And an incorrect one - http://i.imgur.com/63y21up.png
> >
> > What should be done to get texture displayed as on the first pic while
> rotating the matrix of QSGTransformNode or rotating QQuickItem?
> > Switching antialiasing on and off doesn't change the situation.
> >
> > Regards, Artem
> >
> >
> > 2016-06-06 18:24 GMT+02:00 Shawn Rutledge <Shawn.Rutledge at qt.io>:
> >
> > > On 6 Jun 2016, at 12:29, Gunnar Sletta <gunnar at sletta.org> wrote:
> > >
> > >> On 06 Jun 2016, at 09:27, Artem Fedoskin <afedoskin3 at gmail.com>
> wrote:
> > >> Another question - is there any way to draw text solely in Scene
> Graph using QSG classes? I need to draw a lot of text labels and what only
> came to my mind is to draw them using QPainter on a QImage and store it as
> a QSGSimpleTextureNode in the node itself.
> > >
> > > Nope, the text API is all internally, unfortunately. Going through the
> QImage + texture node code path shouldn't be too bad though.
> >
> > It’s not impossible to put text into the scenegraph from C++, but you
> will need to use private APIs, so you will be tied to a range of Qt
> versions where those private APIs don’t change.  You can use QTextLayout to
> generate QGlyphRuns, and create a QSGGlyphNode for each.  Some other QSG
> stuff is public (and there are examples in
> qtdeclarative/examples/quick/scenegraph), but QSGGlyphNode isn't.
> >
> > It may turn out that rendering textures with QPainter, as you suggest,
> is faster anyway.
> >
> >
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160614/d1a32f1c/attachment.html>


More information about the Interest mailing list