aboutsummaryrefslogtreecommitdiff
path: root/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c
diff options
context:
space:
mode:
Diffstat (limited to 'samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c')
-rw-r--r--samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c
index b658f5c..0852cbc 100644
--- a/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c
+++ b/samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c
@@ -24,12 +24,17 @@
------------------------------------------------------------------------*/
+#define _GNU_SOURCE
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <sys/time.h>
+#include <sys/types.h>
+#include <time.h>
+
#include <GL/glew.h>
#include <GL/glx.h>
#include <X11/Xatom.h>
@@ -571,7 +576,16 @@ static void redrawTheWindow(double T)
draw_cube();
popModelview();
+ struct timespec Ta, Tb;
+
+ clock_gettime(CLOCK_MONOTONIC_RAW, &Ta);
glXSwapBuffers(Xdisplay, glX_window_handle);
+ glXWaitGL();
+ clock_gettime(CLOCK_MONOTONIC_RAW, &Tb);
+
+ fprintf(stderr, "glXSwapBuffers + glXWaitGL returned after %f ms\n",
+ 1e3*( (double)Tb.tv_sec + 1e-9*(double)Tb.tv_nsec ) -
+ 1e3*( (double)Ta.tv_sec + 1e-9*(double)Ta.tv_nsec ) );
}
static double getftime(void) {