Font in quickItem 2.0 text
-
Hi all,
I used qt 5.0 and i used text quickItem but the performance is bad when i add text.
Perhaps, used pcf fonts would be better but i don't know if it's possible and how to do that.Thanks
matteli
-
I also saw the problem. This happens because "each text component is used to smooth the fragment shader":http://blog.qt.digia.com/blog/2011/07/15/text-rendering-in-the-qml-scene-graph/
Solution:
[code]
Text {
...
smooth: false
antialiasing: false
}
[/code]
OR you can set property "renderType: Text.NativeRendering", but it will have consequences (for example, on my laptop with win7 ceases to render transparently text and on Blackberry Playbook text will not be displayed at all) -
Ok I try smooth and antialiasing but there is no change with fps.
The Text.NativeRendering is better for fps but on my linux netbook i can't see the text (there are ASCII picture insted of the text). -
To be more precise with the renderType: Text.NativeRendering property. If i use a font.pointSize <48 i can't see the normal text but if it's font.pointSize >=48, there is no problem.
-
Can you give some more information about your use case?
- which platform are you developing for?
- what sort of GPU is available?
- how many Text items are you adding to the scene?
- how are you animating them?
- how many shader effects are you using (if any)?
- what FPS are you getting?
- what does the QML Analyzer (from Qt Creator) say about the workload - is most of the CPU time being spent on animating, or on bindings/signal handlers, or what?
From what I understand, you shouldn't be seeing any performance degradation in Qt5 when rendering text at all, but more information should help to determine what's going on.
Cheers,
Chris. -
- Linux
- It's a netbook with a intel Graphics Media Accelerator 3150
- one
- I don't animate it. I animate a background in the quickview with the signal beforrendering
- I don't use shader effect
- Every 20 ms i ask for an update for my background. If there is no text i have 50 FPS, with a text i have 10 FPS
- I don't use the QML Analyzer but i think it's the text which cause the problem because with a rectangle item there is no problem (50 FPS)
-
Thanks for the info.
Why do you manually ask for repaint updates at a 20 ms polling interval? Doesn't the scene graph in QtQuick2 handle updates to dirty regions automatically? Attempting to hardcode a 50fps refresh rate is rather error-prone, too, because internally the scene graph uses a special timer to perform updates at exactly (or as close to as possible) 60fps. If you're doing things manually which mess with the gl state at 20 ms intervals, strange things may be happening there...
Also, if it's running at 10fps after you add text, I assume that that means that the texture upload to the GPU is taking 5 times as long as it should (ie, its blocking the event loop so you're only seeing 1/5th of the events that you should per second). Are you using the correct drivers for your GPU, or are you using mesa or some sort of software pipeline? I know nothing about the GMA3150, but I guess it's possible that it's just not modern enough to handle opengles2.0 properly?
Finally, how do you animate the background of the QQuickView?
Cheers,
Chris. -
I changed my code. My background can scroll. So i put a timer at 50ms. At timeout, i'm looking for the position of the cursor. If there is on the side of the window, i scroll the background.
So for the moment, the text is not a problem. Perhaps they will be when i will put a lot of text. I will see.The driver for intel GPU are open source and integrated in the OS.
My post is just a remark :
When i put the Text.NativeRendering, the render is fast. If i don't put this option, the render is slow.
I show this too on the openglunderqml example which animated a background with a qml text in front of it. The animation lags (perhaps at 10-15 FPS). Note that this example used older qt5 code (canvas class) and it doesn't compile with beta 2. Probably, my GPU is not rather fast.Now the problem is "that":https://bugreports.qt-project.org/browse/QTBUG-28192
-
Yeah, it sounds like the distance field stuff done in the GPU is what is killing your performance. Thanks for filing the bug, hopefully Eskil or Yoann will take a look at it soon.
Cheers,
Chris.