james_lohr's picture

OnUpdateFrame(FrameEventArgs e) - "Time since last event"

Within OnUpdateFrame(FrameEventArgs e) { } I had been using e.Time as a delta time between frames. However, since I have started using a call to GL.GetInteger(GetPName.Viewport,...) I noticed that the value of e.Time plummeted from the expected 0.0167 to something tiny like: 0.00015.

Having read the description of FrameEventArgs.Time, it says "time since previous event". I'm guessing that it is using the time since my last call to GL.GetInteger(GetPName.Viewport,...) instead of the time since the last update frame. Is this correct? If so, then what is the intended purpose of FrameEventArgs.Time?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
james_lohr's picture

Some more questions related to this:

How efficient is GL.GetInteger(GetPName.Viewport,...)?

I need to know the current viewport dimensions in order to render text pixel-perfectly. My options are:

  • read the viewport dimensions each and every time I would like to render or measure some text (measurement was sometimes happening in logic, hence this thread)
  • require the programmer to explicitly call "RefreshViewport()" each time the viewport changes and he/she wishes to render text

I don't like the second option because it is difficult to remember, and the programmer may spend hours wondering why the text is not being rendered in the correct position. However, the first option has already proved to have side-effects (or perhaps I was simply misuing FrameEventArg.Time?)