This is mostly trivial, but I've personally found it useful when I want
to compare how long a fixed amount of work takes (-f option) or want to
see OpenGL vs. bandwidth bottlenecks (-ww, -wh).
-Nathan
>From 5bc09b76582091e7e548f486e270f9f039318c7a Mon Sep 17 00:00:00 2001
From: Nathan Kidd <nk...@opentext.com>
Date: Tue, 31 May 2011 12:06:04 -0400
Subject: [PATCH] glxspheres: allow specifying window size and max frames to draw
---
mesademos/glxspheres.c | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/mesademos/glxspheres.c b/mesademos/glxspheres.c
index aebfc19..e0589c8 100755
--- a/mesademos/glxspheres.c
+++ b/mesademos/glxspheres.c
@@ -55,10 +55,9 @@
#define NSCHEMES 7
enum {GREY=0, RED, GREEN, BLUE, YELLOW, MAGENTA, CYAN};
-
Display *dpy=NULL; Window win=0, olwin=0;
int usestereo=0, useoverlay=0, useci=0, useimm=0, interactive=0, oldb=1,
- locolor=0;
+ locolor=0, maxframes=0, totalframes=0;
int ncolors=0, nolcolors, colorscheme=GREY;
Colormap colormap=0, olcolormap=0;
GLXContext ctx=0, olctx=0;
@@ -390,9 +389,9 @@ int display(int advance)
if(start>0.)
{
- elapsed+=rrtime()-start; frames++;
+ elapsed+=rrtime()-start; frames++; totalframes++;
mpixels+=(double)width*(double)height/1000000.;
- if(elapsed>2.)
+ if(elapsed>2.|| (maxframes && totalframes>maxframes))
{
snprintf(temps, 255, "%f frames/sec - %f Mpixels/sec",
(double)frames/elapsed, mpixels/elapsed);
@@ -400,6 +399,7 @@ int display(int advance)
elapsed=mpixels=0.; frames=0;
}
}
+ if ( maxframes && totalframes > maxframes) goto bailout;
start=rrtime();
return 0;
@@ -474,7 +474,7 @@ int event_loop(Display *dpy)
void usage(char **argv)
{
- printf("\nUSAGE: %s [-h|-?] [-c] [-fs] [-i] [-l] [-m] [-o] [-p <p>] [-s] [-32]\n\n", argv[0]);
+ printf("\nUSAGE: %s [-h|-?] [-c] [-fs] [-i] [-l] [-m] [-o] [-p <p>] [-s] [-32] [-f <n>] [-ww <w>] [-wh <h>]\n\n", argv[0]);
printf("-c = Use color index rendering (default is RGB)\n");
printf("-fs = Full-screen mode\n");
printf("-i = Interactive mode. Frames advance in response to mouse movement\n");
@@ -484,7 +484,11 @@ void usage(char **argv)
printf("-p <p> = Use (approximately) <p> polygons to render scene\n");
printf("-s = Use stereographic rendering initially\n");
printf(" (this can be switched on and off in the application)\n");
- printf("-32 = Use 32-bit visual (default is 24-bit)\n\n");
+ printf("-32 = Use 32-bit visual (default is 24-bit)\n");
+ printf("-f <n> = max frames to render\n");
+ printf("-ww = window width\n");
+ printf("-wh = window height\n");
+ printf("\n");
exit(0);
}
@@ -512,6 +516,15 @@ int main(int argc, char **argv)
if(!strnicmp(argv[i], "-l", 2)) locolor=1;
if(!strnicmp(argv[i], "-m", 2)) useimm=1;
if(!strnicmp(argv[i], "-o", 2)) useoverlay=1;
+ if(!strnicmp(argv[i], "-ww", 3) && i<argc-1)
+ width=atoi(argv[++i]);
+ if(!strnicmp(argv[i], "-wh", 3) && i<argc-1)
+ height=atoi(argv[++i]);
+ if(!strnicmp(argv[i], "-f", 2) && i<argc-1)
+ {
+ maxframes=atoi(argv[++i]);
+ printf ("Max frames: %d\n", maxframes);
+ }
if(!strnicmp(argv[i], "-p", 2) && i<argc-1)
{
int npolys=atoi(argv[++i]);
--
1.6.3.3
------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
VirtualGL-Devel mailing list
VirtualGL-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtualgl-devel