> On 10 Jan 2019, at 13:24, Vlad Stelmahovsky <vladstelmahov...@gmail.com> 
> wrote:
> 
> Qwt is nice but supports only QWidgets, right?
> 
> so any mobile or Desktop/QML is not supported. Probably this is one of the 
> reasons
> 
> and its not HW accelerated

Last I checked (which was a couple years ago), Charts started out 
widget-oriented, and QtQuick support was added without changing how the 
rendering is done… so it’s not like how the rest of Qt Quick is implemented, 
more like use QPainter to render into an image, then make a texture out of 
that, and then oh yeah you can composite it into the scene as a final step.  
One exception is if you want to draw a simple line chart with GL_LINES, then 
the GPU can do it (but that way there is no built-in antialiasing).  Writing 
highly efficient code (efficient even on low-end GPUs) for arbitrary 2D 
graphics _with_ AA is hard, unless you can afford multi-sampling (to do basic 
low-quality AA on anything that was jaggy), or can afford crazy fragment 
shaders (shadertoys.com approach).  I got as close as I could to the “right 
way” a few years ago for line charts only: making a few extra vertices, and 
having the vertex shader calculate their positions and alphas, so that all the 
strokes have “feathered” edges and reasonably nice corners… it’s very 
efficient, but the shader is complex, and still imperfect, so quality of sharp 
corners especially is not as good as doing it with QPainter.  (Writing it 
really tested my math skills.  And debugging shaders is very hard too.)  But 
maybe I’ll find a way eventually.  It’s one of my back-burner research projects.

QtQuick Shapes don’t have AA.  (Unless you use multi-sampling, or 
NV_path_rendering)  But if we had figured out a good generic solution for 
vertex AA for those (QTriangulator with AA), then the way I'd implement Lottie 
would be to allocate all the vertices for the whole shape at the beginning, 
then use two uniforms for each animated segment, to tell the vertex shader to 
collapse a range of the array (from a cut-off point to the end cap) and 
relocate the end cap.  But it has to be possible for uniforms to be animated.

The next problem is how to use custom shaders and adjustable uniforms without 
breaking batching in the scene graph; today, the number of draw calls goes up 
if you do that.  This is the reason we don’t have GPU-calculated AA line 
charts, and it’s also the reason we don’t have the nice Ellipse that I wrote 
for Qt Quick.  Every custom shader runs in a separate batch (that’s 
unavoidable).  Shaders can’t have dynamically adjusted uniforms (for animation, 
or for limiting the scope of rendering of a vertex array), or even uniforms 
that vary between instances, without breaking batching, and that’s a terrible 
limitation that I would like to see solved somehow in a future scene graph 
implementation, if there’s any way.

https://github.com/kbroulik/lottie-qml looks like a JS/canvas thing?  I’m 
guessing that both of the Lottie implementations make QPainter work pretty hard?

_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to