yeah, here’s what i’m doing in my run() routine:
...
while (!tracerEngine->RenderTiles() && !threadShouldExit())
{
MessageManagerLock *mmLock;
mmLock = new MessageManagerLock;
canvas->repaint();
delete mmLock;
}
...
i used a pointer to MessageManagerLock just so i could be explicit about creating a destroying the lock.
i tried the following as well:
while (!tracerEngine->RenderTiles() && !threadShouldExit())
{
const MessageManagerLock mmLock;
canvas->repaint();
}
but this actually gets me somewhere about 15-20% of the cpu (as opposed to 25-30% using the explicit new/delete technique). not sure if that’s getting the same amount of rendering done in fewer cpu cycles or if it’s blocking longer. i don’t see how it’d be any different, but it seems to be.
(a side note, in your mmlock sample, you say mmLock goes out of scope but how does that happen? don’t you need braces to define your scope? i’m a total c++ newbie which is also why i gravitated towards the more explicit method of new’ing and delete’ing.)
the RenderTiles() routine uses setPixelAt() to make changes to an Image that is then used in my canvas component’s paint() method via a drawImageAt() call.
depending on the speed of the RenderTiles() routine, i get more or less cpu usage – the faster the routine, the less usage i get implying a constant time hang-up somewhere.
i suppose the problem could also be in the drawImageAt routine… but given the ability to speed up the processing by simply moving the mouse around, it seems to be related to messaging. [edit: actually, now that i think about it – the drawImageAt routine is called in a separate thread so i don’t think it’d be capable of slowing down the render thread.)
btw, i notice the drawImageAt routine calls the more complex drawImage routines (the ones that can scale). is there a more direct way to get an image to your component in a 1:1 fashion?
edit: addendum - stowing any of the juce windows causes an even more extreme slowdown - taking 30% down to 10-12%. i can wiggle my mouse in a still open window and get it up to 80% or so…
i will try this on my 3.0ghz p4 with hyperthreading later to see how it likes it. also, this is a debug build at the moment.
thanks!