qpainter performance
-
Hi Im drawing using OpenGL for 3D and qpainter for 2D and text. In my OpenGL widget paintGL(), i have qpainter to draw a sequence of texts on respective positions (e.g. 100 positions with 100 texts). I just realize that those draw calls are killing the performance. Since my OpenGL app is refreshing at ~30Hz, so i try to restrict each frame draw within ~30milliseconds. However, these qpainter draws here would normally cost more than 10milliseconds.
How should I optimize this? Is there any batch processing/draws for qpainter so that I no need issue a draw call in a loop? Thanks.
m_painter.begin(this); for (int i = 0; i<100; ++i) { ... m_painter.drawText(pose, text); ... } m_painter.end();
-
use openGL for text rendering as well. The facilities exist. Mixing the two in one viewport will be problematic.
-
@kent-dorfman Hi do you mind share what facilities you referred to? Like FreeType library?
-
@jsulm Hi the position and text are not changed but just increased in amount, meaning the position and text vectors are increasing in size. Now I just redraw the whole vector every frame. And it also has operations like zoom in/out, and translation on screen. I will try to explore more on your methods. Thanks.
-
-
@kent-dorfman Thanks and will try out those methods also.