Graphics performance under wxGTK
Yuri Borsky
borsky at sbor.ru
Wed Mar 7 04:47:29 PST 2007
Hi Armel!
Yes, using Idle events is often a very good approach. The drawback is that
this approach would stall background work in case of many GUI (or other wx)
events.
Best way would be to be able to implement own event loop, where you may
poll and process events from various event sources (wx and non-wx) as you
see fit.
Own event loops are really a must when you have to do any close to real-time
processing
of events foreign to WX, like networking, specific IPC things etc. However
it seems that this API
is not yet stabilized enouth in WX, while the things are obviously improving
with each release.
Other possible approach is to use threads, but it often is not very
practical too.
Cheers
Yuri
"Armel Asselin" <asselin.armel at wanadoo.fr> ÐÉÛÅÔ ×
ÓÏÏÂÝÅÎÉÉ:002401c75ffc$68b92570$6601a8c0 at elrond...
> > Hi Olivier!
> >
> > Just stumbled over this issue too. My draw is all OpenGL though, but the
> > issue is still the same:
> > using continuous timer blocks my app. I managed to get app responsive
back
> > by adding these two lines:
> >
> > while( theApp->Pending() )
> > theApp->Dispatch();
> >
> > at the end of drawing function, and making sure it does not gets called
> > recursively.
> > I still think that there should be a better way. theApp is of course my
> > wxApp.
> if you want perpetual refreshes, one way is to put your work in the idle
> loop (calling simply Refresh from your window idle handler). as 'normal'
> events are prioritized wrt to idle events, your app is responsive and it
> draws as often as possible.
>
> you can also use the (famous?) moderator pattern where you accept idle
> events but have a 'last_refresh_date' which is checked (against
> wxGetLocalTimeMillis) to be old enough, and if it is the case you update
it
> and refresh the screen.
>
> HIH
> Armel
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
More information about the wx-users
mailing list