aboutsummaryrefslogtreecommitdiff
path: root/samples/OpenGL
diff options
context:
space:
mode:
authorWolfgang Draxinger <Wolfgang.Draxinger@draxit.de>2013-09-14 15:59:51 +0200
committerWolfgang Draxinger <Wolfgang.Draxinger@draxit.de>2013-09-14 15:59:51 +0200
commit987f70c8e9b1bab87647d4ed20df79900d6c0c9e (patch)
tree0a02fdbc8e073dad9e141aa0aa9a378eb6194b45 /samples/OpenGL
parentde232895ac390d09ed242deaadbccbe4812b15bd (diff)
downloadcodesamples-987f70c8e9b1bab87647d4ed20df79900d6c0c9e.tar.gz
codesamples-987f70c8e9b1bab87647d4ed20df79900d6c0c9e.tar.bz2
X11 clobberable window added
Diffstat (limited to 'samples/OpenGL')
-rw-r--r--samples/OpenGL/x11argb_opengl/x11argb_opengl.c10
-rw-r--r--samples/OpenGL/x11argb_opengl_glsl/x11argb_opengl_glsl.c14
2 files changed, 24 insertions, 0 deletions
diff --git a/samples/OpenGL/x11argb_opengl/x11argb_opengl.c b/samples/OpenGL/x11argb_opengl/x11argb_opengl.c
index 1c1e2e0..723c6ae 100644
--- a/samples/OpenGL/x11argb_opengl/x11argb_opengl.c
+++ b/samples/OpenGL/x11argb_opengl/x11argb_opengl.c
@@ -23,12 +23,16 @@
\_____/ FTB.
------------------------------------------------------------------------*/
+#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
+#include <sys/types.h>
+#include <time.h>
+
#include <GL/gl.h>
#include <GL/glx.h>
#include <GL/glxext.h>
@@ -461,7 +465,13 @@ static void redrawTheWindow()
b = fmod(b+0.5, 360.);
c = fmod(c+0.25, 360.);
+ struct timespec Ta, Tb;
+
+ clock_gettime(CLOCK_MONOTONIC_RAW, &Ta);
glXSwapBuffers(Xdisplay, glX_window_handle);
+ clock_gettime(CLOCK_MONOTONIC_RAW, &Tb);
+
+ fprintf(stderr, "glXSwapBuffers returned after %f ms\n", 1e3*((double)Tb.tv_sec + 1e-6*(double)Tb.tv_nsec) - 1e3*((double)Ta.tv_sec + 1e-6*(double)Ta.tv_nsec));
}
int main(int argc, char *argv[])
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) {