Graphics performance under wxGTK

Damjan Jovanovic damjan.jov at gmail.com
Mon Mar 5 06:14:16 PST 2007


On 5 Mar 2007 06:01:56 -0800, olivier.corrio at gmail.com
<olivier.corrio at gmail.com> wrote:
>
> Hi,
> i have made a application on wxMSW and these application needs to
> refresh up to 30 frame/s. So to test that before finishing it, i did a
> simple timer.

Writing code that *needs* to refresh N times per second is a bad idea
- you might not have the necessary system resources to do that, in
which case the event queue keeps getting longer and longer until you
run out of memory and your application crashes, together with probably
many others.

> On wxMSW i can easily make the timer to 20ms and to have easily 30
> frame/s but on wxGTK it blocks the application, and this one can't
> even respond to size event.

Probably because the size event is still far down the queue.

> I use wxDC to draw on panel. Is there a
> way to speed up the application on wxGTK ? I only use DrawText /
> DrawRectangle on it so i don't understand why wxGTK is far more slower
> than wxMSW. Maybe it is because of my timer to test it ?

Don't write timers that way. Stop the timer and restart it once your
drawing code finishes. Don't allow events to stack indefinitely, it's
really bad.

> Thanks a lot Olivier

Damjan




More information about the wx-users mailing list