diff options
author | Wolfgang Draxinger <Wolfgang.Draxinger@draxit.de> | 2014-10-07 03:38:55 +0200 |
---|---|---|
committer | Wolfgang Draxinger <Wolfgang.Draxinger@draxit.de> | 2014-10-07 03:38:55 +0200 |
commit | 1e387fc8eee4925616967edd26de0ee416dbce3f (patch) | |
tree | f6be0b844c724d6c4891f325912bb4f3f2f26c4b /samples/OpenGL/x11argb_opengl/x11argb_opengl.c | |
parent | 3ce7214d2300e2769667649625d160dcdc01499c (diff) | |
parent | b62b7bf28ec0069e6f460fa0f07b64a0dba72557 (diff) | |
download | codesamples-1e387fc8eee4925616967edd26de0ee416dbce3f.tar.gz codesamples-1e387fc8eee4925616967edd26de0ee416dbce3f.tar.bz2 |
Merge branch 'master' of git://github.com/datenwolf/codesamples
Diffstat (limited to 'samples/OpenGL/x11argb_opengl/x11argb_opengl.c')
-rw-r--r-- | samples/OpenGL/x11argb_opengl/x11argb_opengl.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/samples/OpenGL/x11argb_opengl/x11argb_opengl.c b/samples/OpenGL/x11argb_opengl/x11argb_opengl.c index a110a9b..41a7ad0 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> @@ -184,7 +188,7 @@ static void createTheWindow() KeyReleaseMask; attr_mask = - CWBackPixmap| + // CWBackPixmap| CWColormap| CWBorderPixel| CWEventMask; @@ -423,8 +427,10 @@ static void redrawTheWindow() glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); +#if 0 glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +#endif glLightfv(GL_LIGHT0, GL_POSITION, light0_dir); glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_color); @@ -459,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[]) |