My test app has a window and main component take fills the entire client area. I also set the main component on a timer to repaint at 60 frames per second, which renders pretty quickly for some simple drawing etc…but when I add a text editor component (multi-line + 400x800) with a thousand words worth of text, the rendering took a dive and slowed down to about 10-20 frames per second.
I am thinking that the text is being rendered per frame even when most or all the text are unchanged. Is it possible to cache the rendered text and only render the parts that changed? I know that this may introduce a number of problem when the component is not set to Opaque.
Maybe I’m asking for too much
If you repaint the main component all of its children get repainted to. Why don’t you repaint just the components that need repainting instead of the main component?
Depending on the application it might be better to repaint not via a timer but only if a component’s content changed.
That’s so true! All GUI are made so complex just to avoid repainting all the windows all the time.
If you need 60fps, then you’d probably use OpenGL for rendering, and in that case, you’ll call “createComponentSnapshot()” on any change, to generate a texture you’ll use for the interface.
Yeah I know. I’m attempting to write a game with juce, hoping to bypass hardware acceleration (maybe opengl might do the trick).