From: Carl Worth Date: Mon, 13 Aug 2012 00:50:04 +0000 (-0700) Subject: Make glxsimple loop over all drawing methods multiple times X-Git-Url: https://git.cworth.org/git?p=apitrace-tests;a=commitdiff_plain;h=9b9115ace4d56dbc9fad2c2f673a352779d71101 Make glxsimple loop over all drawing methods multiple times We now have 3 different drawing methods, each performed two times, and in a total of 6 different colors. Looping over theese things twice means that we can trim out a single frame of any one method and ensure that "apitrace trim" has some non-trivial trimming to do both before and after the frame of interest. --- diff --git a/cli/src/glxsimple.c b/cli/src/glxsimple.c index 0baf27f..b29fa9e 100644 --- a/cli/src/glxsimple.c +++ b/cli/src/glxsimple.c @@ -147,6 +147,7 @@ paint_rgb_using_texture (double r, double g, double b) static void draw (Display *dpy, Window window, int width, int height) { + int i; GLenum glew_err; int visual_attr[] = { @@ -179,17 +180,26 @@ draw (Display *dpy, Window window, int width, int height) set_2d_projection (); - /* Frame 1: Draw a solid (magenta) frame using glClear. */ - paint_rgb_using_clear (1, 0, 1); - glXSwapBuffers (dpy, window); - - /* Frame 2: Draw a solid (yellow) frame using GLSL. */ - paint_rgb_using_glsl (1, 1, 0); - glXSwapBuffers (dpy, window); - - /* Frame 3: Draw a solid (cyan) frame using a texture. */ - paint_rgb_using_texture (0, 1, 1); - glXSwapBuffers (dpy, window); +/* Simply count through some colors, frame by frame. */ +#define RGB(frame) (((frame+1)/4) % 2), (((frame+1)/2) % 2), ((frame+1) % 2) + + int frame = 0; + for (i = 0; i < 2; i++) { + /* Frame: Draw a solid (magenta) frame using glClear. */ + paint_rgb_using_clear (RGB(frame)); + glXSwapBuffers (dpy, window); + frame++; + + /* Frame: Draw a solid (yellow) frame using GLSL. */ + paint_rgb_using_glsl (RGB(frame)); + glXSwapBuffers (dpy, window); + frame++; + + /* Frame: Draw a solid (cyan) frame using a texture. */ + paint_rgb_using_texture (RGB(frame)); + glXSwapBuffers (dpy, window); + frame++; + } /* Cleanup */ glXDestroyContext (dpy, ctx);