xdemo/glxswapcontrol: Move get_framge_usage after the swap.
authorPauli Nieminen <suokkos@gmail.com>
Mon, 3 Aug 2009 19:05:33 +0000 (12:05 -0700)
committerBrian Paul <brianp@vmware.com>
Mon, 3 Aug 2009 19:42:05 +0000 (13:42 -0600)
This fixes the problem that first frame would report bogus usage values.
Problem was caused because get_frame_usage returned data from previous buffer
swap.

Signed-off-by: Pauli Nieminen <suokkos@gmail.com>
progs/xdemos/glxswapcontrol.c

index 5a5d084f90913bcced4ecab280736933a480a516..8cdd560207e54b5abae2ca2f930ada4ce8a986c7 100644 (file)
@@ -587,6 +587,9 @@ event_loop(Display *dpy, Window win)
       angle += 2.0;
 
       draw();
+
+      glXSwapBuffers(dpy, win);
+
       if ( get_frame_usage != NULL ) {
         GLfloat   temp;
         
@@ -594,8 +597,6 @@ event_loop(Display *dpy, Window win)
         frame_usage += temp;
       }
 
-      glXSwapBuffers(dpy, win);
-
       /* calc framerate */
       {
          static int t0 = -1;