Trying to understand the JUCE graphic system a bit better, and can’t figure out why paint is invoked more often than update. If anything I would have assumed it would be the other way around.
So as a basic test I created an Animated Application in Projucer. In header I declared two int counter variables, initialized to zero, to keep track of how many times update is invoked, which off course should be the same as what is in setFramedPerSecond unless I make that too high, and how many times paint is actually invoked.
So my basic test code is;
void MainComponent::update()
{
timerCounter++;
}
void MainComponent::paint (Graphics& g)
{
g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
GUICounter++;
g.setColour(Colours::white);
g.drawText(String(timerCounter), 0, 0, 100, 20, true);
g.drawText(String(GUICounter), 0, 20, 100, 20, true);
}
Too see what is going on I then make the update super slow, to one time per second setFramesPerSecond (1);
I can simply not understand why my two counter variables are not somewhat synchronized. Sure I understand when the application is run resized is invoked and it invokes paint. So at first the paint counter is a few ahead, but then a few updates later it suddenly jumps about +45 seemingly getting invoked +45 times! Then a bit later again +45, and then it does not seem to jump again, but at that point the paint counter is about 90 ahead of the update counter.
Discrepancy between the two, update() and paint(), remained the same, unless I set the frames per second impossible high.
