Re: [GtkGLExt] How to only update at screen refresh rate?



On Thu, 2007-04-26 at 19:13 -0600, Timothy M. Shead wrote:
> On Mon, 2007-04-23 at 10:38 -0400, Eric Jonas wrote:
> > Hello! Apologies if this question is misdirected, as I'm somewhat new to
> > gtk in general. Is there a recommended way of writing my app such that
> > the expose event is only called once per screen redraw? Right now it
> > seems like I'm looping and doing a lot of extra work (and getting 1000s
> > of FPS) when I really don't need to be. I searched through the gtkglext
> > examples as well as the gtk docs and couldn't find anything that seemed
> > relevant. Thanks!
> 
> Not sure what you're trying to describe - the expose event gets called
> by X whenever a window needs to be redrawn.  If you redraw when you
> receive the expose event, you're doing the right thing.
> 

Thanks for the quick reply! In a lot of the examples, the entire window
is invalidated and updated in either an idle handler or a timeout from
some timer. I'm trying to render some scientific data and on one hand I
don't want to rerender every time a new point comes in (at 1kHz),
because that seems really excessive (and pegs my CPU). 

I'm assuming that the screen is updated at some fixed rate, say 60 or 72
Hz. It would be great if there were some way to only invalidate the
window / trigger a redraw on this event. 

I could also set up a timer that ran at, say, ~72 Hz, but I worry that
the resulting display would precess through actual screen redraws. 
			...Eric





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]