next up previous
Next: 4.2 Remaining Routines Up: 4.1 The Programming Interface Previous: 4.1.1 GLR Setup

4.1.2 Using GLR Render Intervals

Frame buffer state is retained during a render interval (or until the interval is expired). The interval begins with glrBeginRenderInterval and ends with glrEndRenderInterval:

  int width = 400, height = 400;
  int timeout = 500;              /* milliseconds */
  int wait = -1;                  /* negative means forever */
  int duration;                   /* returned as milliseconds */

  success = glrBeginRenderInterval(canvas, width, height, timeout, wait);
  /* 
   * Perform OpenGL operations.
   */
  success = glrEndRenderInterval(canvas, &duration);
In the above example (assuming the interval is successfully begun), a 400 by 400 pixel unclipped frame buffer rectangle would be guaranteed retained for at least 500 milliseconds (of real time) once the render interval is scheduled. The wait parameter determines how long to wait for the render interval to be scheduled. Zero means return immediately if the interval can not begin immediately; a negative value means wait forever; otherwise, wait for the specified number of milliseconds.

The value returned by glrEndRenderInterval indicates if the render interval was expired. If the interval was expired, frame buffer state retrieved within the interval cannot be assumed correct. The duration returned by glrEndRenderInterval indicates the duration of the interval from its initiation (not including time waiting for the interval to be scheduled) and glrEndRenderInterval being called.

This interval duration can be used to determine by how many milliseconds the render interval timeout was exceeded or over-estimated. This time may be of use when resubmitting an expired render interval with a longer render interval duration or for better estimating similar, future render intervals.

A more involved example of using render intervals is presented later in Section 4.3.

Sometimes, a client may want to determine if the current render interval has expired without ending the render interval itself. This is particularly useful if a long render interval has been scheduled. The expiration status of the current interval can be checked like this:

  stillGood = glrQueryRenderIntervalStatus(canvas);
  if (stillGood == 0) {
    /* Interval has expired.  glrEndRenderInterval guaranteed to fail. */
  } else {
    /* State read back before glrQueryRenderIntervalStatus is valid. */
  }



next up previous
Next: 4.2 Remaining Routines Up: 4.1 The Programming Interface Previous: 4.1.1 GLR Setup



Mark Kilgard
Fri Jan 5 18:13:30 PST 1996