QNanoPainter Available!

About 2.5 months ago I introduced QNanoPainter project for implementing custom QQuickItems. We’ve been really busy (and continue to be so) with other things but took now the time to push QNanoPainter publicly available for wider audience in here: https://github.com/QUItCoding/qnanopainter


It’s not ready (as software never is), but already quite capable for serious kicking of tires. Just clone it, build with Qt Creator / qmake and run the provided examples. And when you want to try implementing own items, straightforward instructions to get started are available at front-page README.

If you dig it and want to assist in improving QNanoPainter, here are few ideas for patches:

  • We have tested QNanoPainter on OS X, Linux, Android and iOS. What’s missing at least is making it work on Windows (with dynamic OpenGL build of Qt).
  • Documentation with QDoc has been started but it’s not complete. There are plenty of ”TODO: Write more documentation here” comments in classes and documentation could overall be improved and styled.
  • Current NanoVG version used is from fork https://github.com/ytsedan/nanovg at bfbac9a35e, with some additions. Custom additions are marked with ”// ### Added”. Some reasons to go with this fork for now instead of upstream are discussed in https://github.com/memononen/nanovg/issues/216. What should be done is to update NanoVG to some latest version, apply additions and test properly. Maybe own NanoVG fork with additions should be maintained?
  • Instead of stb_truetype and stb_image code could be ported to use Qt for images and texts. I think at least text rendering would require private Qt headers and additions in Qt side, so may not be that straightforward.
  • Bugfixes!

We received some good comments already and hopefully now more & patches when sources are publicly available. I’ll write some more blog posts later, but now.. Clone!

Comments

Gunnar Roth said…
Thank you very much for this. It looks very promising and fills A gap in qt quick. Is there a possibility to add a image or texture as render target,so render results can be shared and cached between instances?
Gunnar Roth said…
Today I forked the git repo and made some minor changes to make it work on windows using angle and wec2013. See https://github.com/gunrot/qnanopainter
@Gunnar: Thanks! There is currently no support for separate rendering targets. QNanoQuickItem is QQuickFramebufferObject so all rendering goes through FBO, meaning that repainting is not happening when content doesn’t change. Also it’s a texture provider (QSGTextureProvider) so can be used directly in ShaderEffects and other classes that consume texture providers.

If something else is needed feel free to do pull requests, and please do pull request also of windows support when it's ready for that.
Unknown said…
@Kaitsu did you done any profiling on QPainter as QPainter also use opengl for acceleration?
there must be some draw call optimization on NanoVG side.
Michal: I have done some QPainter vs. QNanoPainter testing, tester example app is also available in the repository. QPainter is used on Qt scene graph with QQuickPaintedItem, and setting its renderTarget to QQuickPaintedItem::FramebufferObject will enable OpenGL paint engine. In my testing QPainter is with some paint methods faster but mostly QNanoPainter is about equally fast or faster. But haven’t done deeper profiling on where the differences come from.

Popular posts from this blog

Qt 5.10 QML Shape testing

Qt Quick 3D DynamicMeters demo

Qt 5.10 Rendering Benchmarks