summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Faye-Lund <erik.faye-lund@collabora.com>2023-07-26 20:09:26 +0200
committerErik Faye-Lund <kusmabite@gmail.com>2023-10-19 11:36:03 +0200
commit80ddc6ba89981d4863de2c97b073dce8354255ed (patch)
tree96353fcaff9cf3051adffe8ecab891b92f888b3d
parent4d9dfda9198f10e0a381f8aea8a6d0812cad1df1 (diff)
xdemos: clean up whitespace
This tries to make whitespace placement consistent... Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
-rw-r--r--src/xdemos/glsync.c2
-rw-r--r--src/xdemos/glthreads.c20
-rw-r--r--src/xdemos/glxcontexts.c26
-rw-r--r--src/xdemos/glxdemo.c48
-rw-r--r--src/xdemos/glxgears.c48
-rw-r--r--src/xdemos/glxgears_fbconfig.c62
-rw-r--r--src/xdemos/glxgears_pixmap.c22
-rw-r--r--src/xdemos/glxheads.c8
-rw-r--r--src/xdemos/glxinfo.c12
-rw-r--r--src/xdemos/glxpbdemo.c49
-rw-r--r--src/xdemos/glxpixmap.c62
-rw-r--r--src/xdemos/glxsnoop.c36
-rw-r--r--src/xdemos/glxswapcontrol.c189
-rw-r--r--src/xdemos/manywin.c8
-rw-r--r--src/xdemos/msctest.c2
-rw-r--r--src/xdemos/multictx.c34
-rw-r--r--src/xdemos/offset.c28
-rw-r--r--src/xdemos/omlsync.c2
-rw-r--r--src/xdemos/opencloseopen.c27
-rw-r--r--src/xdemos/pbdemo.c64
-rw-r--r--src/xdemos/pbinfo.c14
-rw-r--r--src/xdemos/pbutil.c43
-rw-r--r--src/xdemos/pbutil.h8
-rw-r--r--src/xdemos/shape.c60
-rw-r--r--src/xdemos/sharedtex.c8
-rw-r--r--src/xdemos/sharedtex_mt.c14
-rw-r--r--src/xdemos/texture_from_pixmap.c4
-rw-r--r--src/xdemos/wincopy.c28
-rw-r--r--src/xdemos/xfont.c64
-rw-r--r--src/xdemos/xrotfontdemo.c63
-rw-r--r--src/xdemos/xuserotfont.c2
-rw-r--r--src/xdemos/yuvrect_client.c51
32 files changed, 555 insertions, 553 deletions
diff --git a/src/xdemos/glsync.c b/src/xdemos/glsync.c
index e24eb2be..e87edefb 100644
--- a/src/xdemos/glsync.c
+++ b/src/xdemos/glsync.c
@@ -217,7 +217,7 @@ main(int argc, char *argv[])
sizehints.x = 0;
sizehints.y = 0;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
diff --git a/src/xdemos/glthreads.c b/src/xdemos/glthreads.c
index 18f7e14d..51b6f863 100644
--- a/src/xdemos/glthreads.c
+++ b/src/xdemos/glthreads.c
@@ -275,10 +275,10 @@ draw_loop(struct winthread *wt)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
- glRotatef(wt->Angle, 0, 1, 0);
- glRotatef(wt->Angle, 1, 0, 0);
- glScalef(0.7, 0.7, 0.7);
- draw_object();
+ glRotatef(wt->Angle, 0, 1, 0);
+ glRotatef(wt->Angle, 1, 0, 0);
+ glScalef(0.7, 0.7, 0.7);
+ draw_object();
glPopMatrix();
if (Locking)
@@ -340,8 +340,7 @@ keypress(XEvent *event, struct winthread *wt)
if (!Animate)
signal_redraw();
break;
- default:
- ; /* nop */
+ default:; /* nop */
}
}
@@ -399,7 +398,7 @@ event_loop(Display *dpy)
}
break;
default:
- /*no-op*/ ;
+ /*no-op*/;
}
}
}
@@ -427,8 +426,7 @@ event_loop_multi(void)
case KeyPress:
keypress(&event, wt);
break;
- default:
- ; /* nop */
+ default:; /* nop */
}
}
w = (w + 1) % NumWinThreads;
@@ -488,7 +486,7 @@ create_window(struct winthread *wt, GLXContext shareCtx)
XSizeHints sizehints;
sizehints.x = xpos;
sizehints.y = ypos;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(wt->Dpy, win, &sizehints);
@@ -673,7 +671,7 @@ main(int argc, char *argv[])
/* Create the threads */
for (i = 0; i < numThreads; i++) {
pthread_create(&WinThreads[i].Thread, NULL, thread_function,
- (void*) &WinThreads[i]);
+ (void *) &WinThreads[i]);
printf("glthreads: Created thread %p\n", (void *) WinThreads[i].Thread);
}
diff --git a/src/xdemos/glxcontexts.c b/src/xdemos/glxcontexts.c
index d47608a4..b9a8be1f 100644
--- a/src/xdemos/glxcontexts.c
+++ b/src/xdemos/glxcontexts.c
@@ -56,7 +56,7 @@ current_time(void)
{
struct timeval tv;
#ifdef __VMS
- (void) gettimeofday(&tv, NULL );
+ (void) gettimeofday(&tv, NULL);
#else
struct timezone tz;
(void) gettimeofday(&tv, &tz);
@@ -324,7 +324,7 @@ draw(Display *dpy, Window win)
{
GLXContext ctx;
- ctx = glXCreateContext( dpy, visinfo, NULL, True );
+ ctx = glXCreateContext(dpy, visinfo, NULL, True);
if (!ctx) {
printf("Error: glXCreateContext failed\n");
exit(1);
@@ -369,13 +369,13 @@ make_window(Display *dpy, const char *name,
Window root;
Window win;
- scrnum = DefaultScreen( dpy );
- root = RootWindow( dpy, scrnum );
+ scrnum = DefaultScreen(dpy);
+ root = RootWindow(dpy, scrnum);
if (visinfo)
XFree(visinfo);
- visinfo = glXChooseVisual( dpy, scrnum, attribs );
+ visinfo = glXChooseVisual(dpy, scrnum, attribs);
if (!visinfo) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
@@ -384,21 +384,21 @@ make_window(Display *dpy, const char *name,
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
attr.override_redirect = 0;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
- win = XCreateWindow( dpy, root, x, y, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
+ win = XCreateWindow(dpy, root, x, y, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr);
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
@@ -468,11 +468,11 @@ event_loop(Display *dpy)
tRot0 = t;
/* advance rotation for next frame */
- angle += 70.0 * dt; /* 70 degrees per second */
+ angle += 70.0 * dt; /* 70 degrees per second */
if (angle > 3600.0)
angle -= 3600.0;
- draw( dpy, win );
+ draw(dpy, win);
frames++;
@@ -511,7 +511,7 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
- dpyName = argv[i+1];
+ dpyName = argv[i + 1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
diff --git a/src/xdemos/glxdemo.c b/src/xdemos/glxdemo.c
index d328fa46..221bbba5 100644
--- a/src/xdemos/glxdemo.c
+++ b/src/xdemos/glxdemo.c
@@ -19,12 +19,12 @@ redraw(Display *dpy, Window w)
{
printf("Redraw event\n");
- glClear( GL_COLOR_BUFFER_BIT );
+ glClear(GL_COLOR_BUFFER_BIT);
- glColor3f( 1.0, 1.0, 0.0 );
- glRectf( -0.8, -0.8, 0.8, 0.8 );
+ glColor3f(1.0, 1.0, 0.0);
+ glRectf(-0.8, -0.8, 0.8, 0.8);
- glXSwapBuffers( dpy, w );
+ glXSwapBuffers(dpy, w);
}
@@ -33,10 +33,10 @@ static void
resize(unsigned int width, unsigned int height)
{
printf("Resize event\n");
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
+ glViewport(0, 0, width, height);
+ glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
+ glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
}
@@ -59,10 +59,10 @@ make_rgb_db_window(Display *dpy,
GLXContext ctx;
XVisualInfo *visinfo;
- scrnum = DefaultScreen( dpy );
- root = RootWindow( dpy, scrnum );
+ scrnum = DefaultScreen(dpy);
+ root = RootWindow(dpy, scrnum);
- visinfo = glXChooseVisual( dpy, scrnum, attrib );
+ visinfo = glXChooseVisual(dpy, scrnum, attrib);
if (!visinfo) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
@@ -71,21 +71,21 @@ make_rgb_db_window(Display *dpy,
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
- win = XCreateWindow( dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
+ win = XCreateWindow(dpy, root, 0, 0, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr);
- ctx = glXCreateContext( dpy, visinfo, NULL, True );
+ ctx = glXCreateContext(dpy, visinfo, NULL, True);
if (!ctx) {
printf("Error: glXCreateContext failed\n");
exit(1);
}
- glXMakeCurrent( dpy, win, ctx );
+ glXMakeCurrent(dpy, win, ctx);
return win;
}
@@ -97,14 +97,14 @@ event_loop(Display *dpy)
XEvent event;
while (1) {
- XNextEvent( dpy, &event );
+ XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
- redraw( dpy, event.xany.window );
+ redraw(dpy, event.xany.window);
break;
case ConfigureNotify:
- resize( event.xconfigure.width, event.xconfigure.height );
+ resize(event.xconfigure.width, event.xconfigure.height);
break;
}
}
@@ -125,13 +125,13 @@ main(int argc, char *argv[])
return 1;
}
- win = make_rgb_db_window( dpy, 300, 300 );
+ win = make_rgb_db_window(dpy, 300, 300);
- glShadeModel( GL_FLAT );
- glClearColor( 0.5, 0.5, 0.5, 1.0 );
+ glShadeModel(GL_FLAT);
+ glClearColor(0.5, 0.5, 0.5, 1.0);
- XMapWindow( dpy, win );
+ XMapWindow(dpy, win);
- event_loop( dpy );
+ event_loop(dpy);
return 0;
}
diff --git a/src/xdemos/glxgears.c b/src/xdemos/glxgears.c
index 2967affa..eb177df0 100644
--- a/src/xdemos/glxgears.c
+++ b/src/xdemos/glxgears.c
@@ -59,7 +59,7 @@ current_time(void)
{
struct timeval tv;
#ifdef __VMS
- (void) gettimeofday(&tv, NULL );
+ (void) gettimeofday(&tv, NULL);
#else
struct timezone tz;
(void) gettimeofday(&tv, &tz);
@@ -464,7 +464,7 @@ no_border(Display *dpy, Window w)
motif_hints.decorations = flags;
/* get the atom for the property */
- prop = XInternAtom( dpy, "_MOTIF_WM_HINTS", True );
+ prop = XInternAtom(dpy, "_MOTIF_WM_HINTS", True);
if (!prop) {
/* something went wrong! */
return;
@@ -473,13 +473,13 @@ no_border(Display *dpy, Window w)
/* not sure this is correct, seems to work, XA_WM_HINTS didn't work */
proptype = prop;
- XChangeProperty( dpy, w, /* display, window */
- prop, proptype, /* property, type */
- 32, /* format: 32-bit datums */
- PropModeReplace, /* mode */
- (unsigned char *) &motif_hints, /* data */
- PROP_MOTIF_WM_HINTS_ELEMENTS /* nelements */
- );
+ XChangeProperty(dpy, w, /* display, window */
+ prop, proptype, /* property, type */
+ 32, /* format: 32-bit datums */
+ PropModeReplace, /* mode */
+ (unsigned char *) &motif_hints, /* data */
+ PROP_MOTIF_WM_HINTS_ELEMENTS /* nelements */
+ );
}
static void
@@ -545,8 +545,8 @@ make_window(Display *dpy, const char *name,
attribs[i++] = None;
- scrnum = DefaultScreen( dpy );
- root = RootWindow( dpy, scrnum );
+ scrnum = DefaultScreen(dpy);
+ root = RootWindow(dpy, scrnum);
visinfo = glXChooseVisual(dpy, scrnum, attribs);
if (!visinfo) {
@@ -564,14 +564,14 @@ make_window(Display *dpy, const char *name,
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
/* XXX this is a bad way to get a borderless window! */
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
- win = XCreateWindow( dpy, root, x, y, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
+ win = XCreateWindow(dpy, root, x, y, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr);
if (fullscreen) {
no_border(dpy, win);
@@ -583,7 +583,7 @@ make_window(Display *dpy, const char *name,
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
@@ -591,7 +591,7 @@ make_window(Display *dpy, const char *name,
None, (char **)NULL, 0, &sizehints);
}
- ctx = glXCreateContext( dpy, visinfo, NULL, True );
+ ctx = glXCreateContext(dpy, visinfo, NULL, True);
if (!ctx) {
printf("Error: glXCreateContext failed\n");
exit(1);
@@ -797,7 +797,7 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
- dpyName = argv[i+1];
+ dpyName = argv[i + 1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
@@ -809,19 +809,19 @@ main(int argc, char *argv[])
else if (strcmp(argv[i], "-stereo") == 0) {
stereo = GL_TRUE;
}
- else if (i < argc-1 && strcmp(argv[i], "-samples") == 0) {
- samples = strtod(argv[i+1], NULL );
+ else if (i < argc - 1 && strcmp(argv[i], "-samples") == 0) {
+ samples = strtod(argv[i + 1], NULL);
++i;
}
- else if (i < argc-1 && strcmp(argv[i], "-swapinterval") == 0) {
- swapinterval = strtod(argv[i+1], NULL );
+ else if (i < argc - 1 && strcmp(argv[i], "-swapinterval") == 0) {
+ swapinterval = strtod(argv[i + 1], NULL);
++i;
}
else if (strcmp(argv[i], "-fullscreen") == 0) {
fullscreen = GL_TRUE;
}
- else if (i < argc-1 && strcmp(argv[i], "-geometry") == 0) {
- XParseGeometry(argv[i+1], &x, &y, &winWidth, &winHeight);
+ else if (i < argc - 1 && strcmp(argv[i], "-geometry") == 0) {
+ XParseGeometry(argv[i + 1], &x, &y, &winWidth, &winHeight);
i++;
}
else {
diff --git a/src/xdemos/glxgears_fbconfig.c b/src/xdemos/glxgears_fbconfig.c
index 55c5fd0b..438ffd6c 100644
--- a/src/xdemos/glxgears_fbconfig.c
+++ b/src/xdemos/glxgears_fbconfig.c
@@ -67,7 +67,7 @@ current_time(void)
{
struct timeval tv;
#ifdef __VMS
- (void) gettimeofday(&tv, NULL );
+ (void) gettimeofday(&tv, NULL);
#else
struct timezone tz;
(void) gettimeofday(&tv, &tz);
@@ -342,10 +342,10 @@ dummy_destroy_window(Display *dpy, GLXWindow win)
static void
init_fbconfig_functions(Display *dpy, int scrnum)
{
- const char * glx_extensions;
- const char * match;
+ const char *glx_extensions;
+ const char *match;
static const char ext_name[] = "GLX_SGIX_fbconfig";
- const size_t len = strlen( ext_name );
+ const size_t len = strlen(ext_name);
int major;
int minor;
GLboolean ext_version_supported;
@@ -354,23 +354,23 @@ init_fbconfig_functions(Display *dpy, int scrnum)
/* Determine if GLX 1.3 or greater is supported.
*/
- glXQueryVersion(dpy, & major, & minor);
+ glXQueryVersion(dpy, &major, &minor);
glx_1_3_supported = (major == 1) && (minor >= 3);
/* Determine if GLX_SGIX_fbconfig is supported.
*/
glx_extensions = glXQueryExtensionsString(dpy, scrnum);
- match = strstr( glx_extensions, ext_name );
+ match = strstr(glx_extensions, ext_name);
ext_version_supported = (match != NULL)
&& ((match[len] == '\0') || (match[len] == ' '));
- printf( "GLX 1.3 is %ssupported.\n",
- (glx_1_3_supported) ? "" : "not " );
- printf( "%s is %ssupported.\n",
- ext_name, (ext_version_supported) ? "" : "not " );
+ printf("GLX 1.3 is %ssupported.\n",
+ (glx_1_3_supported) ? "" : "not ");
+ printf("%s is %ssupported.\n",
+ ext_name, (ext_version_supported) ? "" : "not ");
- if ( glx_1_3_supported ) {
+ if (glx_1_3_supported) {
choose_fbconfig = (PFNGLXCHOOSEFBCONFIGPROC)
glXGetProcAddressARB((GLubyte *) "glXChooseFBConfig");
get_visual_from_fbconfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)
@@ -382,7 +382,7 @@ init_fbconfig_functions(Display *dpy, int scrnum)
destroy_window = (PFNGLXDESTROYWINDOWPROC)
glXGetProcAddressARB((GLubyte *) "glXDestroyWindow");
}
- else if ( ext_version_supported ) {
+ else if (ext_version_supported) {
choose_fbconfig = (PFNGLXCHOOSEFBCONFIGPROC)
glXGetProcAddressARB((GLubyte *) "glXChooseFBConfigSGIX");
get_visual_from_fbconfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)
@@ -393,23 +393,23 @@ init_fbconfig_functions(Display *dpy, int scrnum)
destroy_window = dummy_destroy_window;
}
else {
- printf( "This demo requires either GLX 1.3 or %s be supported.\n",
- ext_name );
+ printf("This demo requires either GLX 1.3 or %s be supported.\n",
+ ext_name);
exit(1);
}
- if ( choose_fbconfig == NULL ) {
- printf( "glXChooseFBConfig not found!\n" );
+ if (choose_fbconfig == NULL) {
+ printf("glXChooseFBConfig not found!\n");
exit(1);
}
- if ( get_visual_from_fbconfig == NULL ) {
- printf( "glXGetVisualFromFBConfig not found!\n" );
+ if (get_visual_from_fbconfig == NULL) {
+ printf("glXGetVisualFromFBConfig not found!\n");
exit(1);
}
- if ( create_new_context == NULL ) {
- printf( "glXCreateNewContext not found!\n" );
+ if (create_new_context == NULL) {
+ printf("glXCreateNewContext not found!\n");
exit(1);
}
}
@@ -432,7 +432,7 @@ make_window(Display *dpy, const char *name,
GLX_DOUBLEBUFFER, GL_TRUE,
GLX_DEPTH_SIZE, 1,
None };
- GLXFBConfig * fbconfig;
+ GLXFBConfig *fbconfig;
int num_configs;
int scrnum;
int i;
@@ -444,11 +444,11 @@ make_window(Display *dpy, const char *name,
GLXContext ctx;
XVisualInfo *visinfo;
- scrnum = DefaultScreen( dpy );
- root = RootWindow( dpy, scrnum );
+ scrnum = DefaultScreen(dpy);
+ root = RootWindow(dpy, scrnum);
init_fbconfig_functions(dpy, scrnum);
- fbconfig = (*choose_fbconfig)(dpy, scrnum, attrib, & num_configs);
+ fbconfig = (*choose_fbconfig)(dpy, scrnum, attrib, &num_configs);
if (fbconfig == NULL) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
@@ -456,7 +456,7 @@ make_window(Display *dpy, const char *name,
printf("\nThe following fbconfigs meet the requirements. The first one "
"will be used.\n\n");
- for ( i = 0 ; i < num_configs ; i++ ) {
+ for (i = 0; i < num_configs; i++) {
PrintFBConfigInfo(dpy, scrnum, fbconfig[i], GL_TRUE);
}
@@ -465,20 +465,20 @@ make_window(Display *dpy, const char *name,
assert(visinfo != NULL);
attr.background_pixel = 0;
attr.border_pixel = 0;
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
- win = XCreateWindow( dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
+ win = XCreateWindow(dpy, root, 0, 0, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr);
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
@@ -589,7 +589,7 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
- dpyName = argv[i+1];
+ dpyName = argv[i + 1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
diff --git a/src/xdemos/glxgears_pixmap.c b/src/xdemos/glxgears_pixmap.c
index bf65e618..e9de2cb1 100644
--- a/src/xdemos/glxgears_pixmap.c
+++ b/src/xdemos/glxgears_pixmap.c
@@ -63,7 +63,7 @@ current_time(void)
{
struct timeval tv;
#ifdef __VMS
- (void) gettimeofday(&tv, NULL );
+ (void) gettimeofday(&tv, NULL);
#else
struct timezone tz;
(void) gettimeofday(&tv, &tz);
@@ -340,7 +340,7 @@ make_window(Display *dpy, const char *name,
GLX_DOUBLEBUFFER, GL_FALSE,
GLX_DEPTH_SIZE, 1,
None };
- GLXFBConfig * fbconfig;
+ GLXFBConfig *fbconfig;
int num_configs;
int scrnum;
XSetWindowAttributes attr;
@@ -351,10 +351,10 @@ make_window(Display *dpy, const char *name,
gears->width = width;
gears->height = height;
- scrnum = DefaultScreen( dpy );
- root = RootWindow( dpy, scrnum );
+ scrnum = DefaultScreen(dpy);
+ root = RootWindow(dpy, scrnum);
- fbconfig = glXChooseFBConfig(dpy, scrnum, attrib, & num_configs);
+ fbconfig = glXChooseFBConfig(dpy, scrnum, attrib, &num_configs);
if (fbconfig == NULL) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
@@ -365,20 +365,20 @@ make_window(Display *dpy, const char *name,
assert(visinfo != NULL);
attr.background_pixel = 0;
attr.border_pixel = 0;
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
- gears->win = XCreateWindow( dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
+ gears->win = XCreateWindow(dpy, root, 0, 0, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr);
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, gears->win, &sizehints);
@@ -504,7 +504,7 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
- dpyName = argv[i+1];
+ dpyName = argv[i + 1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
diff --git a/src/xdemos/glxheads.c b/src/xdemos/glxheads.c
index f1d13e2e..bc785d31 100644
--- a/src/xdemos/glxheads.c
+++ b/src/xdemos/glxheads.c
@@ -119,7 +119,7 @@ AddHead(const char *displayName)
XSizeHints sizehints;
sizehints.x = xpos;
sizehints.y = ypos;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
@@ -145,7 +145,7 @@ AddHead(const char *displayName)
/* save the info for this head */
{
struct head *h = &Heads[NumHeads];
- const char * tmp;
+ const char *tmp;
if (strlen(displayName) + 1 > sizeof(h->DisplayName)) {
Error(displayName, "displayName string length overflow");
@@ -180,7 +180,7 @@ AddHead(const char *displayName)
strcpy(h->Renderer, tmp);
NumHeads++;
- return &Heads[NumHeads-1];
+ return &Heads[NumHeads - 1];
}
}
@@ -254,7 +254,7 @@ EventLoop(void)
case KeyPress:
return;
default:
- /*no-op*/ ;
+ /*no-op*/;
}
}
else {
diff --git a/src/xdemos/glxinfo.c b/src/xdemos/glxinfo.c
index 996ab6dc..df0deb08 100644
--- a/src/xdemos/glxinfo.c
+++ b/src/xdemos/glxinfo.c
@@ -46,7 +46,7 @@
#ifndef GLX_NONE_EXT
-#define GLX_NONE_EXT 0x8000
+#define GLX_NONE_EXT 0x8000
#endif
#ifndef GLX_TRANSPARENT_RGB
@@ -54,19 +54,19 @@
#endif
#ifndef GLX_RGBA_BIT
-#define GLX_RGBA_BIT 0x00000001
+#define GLX_RGBA_BIT 0x00000001
#endif
#ifndef GLX_COLOR_INDEX_BIT
-#define GLX_COLOR_INDEX_BIT 0x00000002
+#define GLX_COLOR_INDEX_BIT 0x00000002
#endif
struct visual_attribs
{
/* X visual attribs */
- int id; /* May be visual ID or FBConfig ID */
- int vis_id; /* Visual ID. Only set for FBConfigs */
+ int id; /* May be visual ID or FBConfig ID */
+ int vis_id; /* Visual ID. Only set for FBConfigs */
int klass;
int depth;
int redMask, greenMask, blueMask;
@@ -1347,7 +1347,7 @@ parse_args(int argc, char *argv[], struct options *options)
usage();
exit(0);
}
- else if(strcmp(argv[i], "-s") == 0) {
+ else if (strcmp(argv[i], "-s") == 0) {
options->singleLine = GL_TRUE;
}
else {
diff --git a/src/xdemos/glxpbdemo.c b/src/xdemos/glxpbdemo.c
index f24b4c75..8a92875b 100644
--- a/src/xdemos/glxpbdemo.c
+++ b/src/xdemos/glxpbdemo.c
@@ -159,8 +159,8 @@ Setup(int width, int height)
}
/* Create Pbuffer */
- gPBuffer = MakePbuffer( gDpy, gScreen, width, height );
- if (gPBuffer==None) {
+ gPBuffer = MakePbuffer(gDpy, gScreen, width, height);
+ if (gPBuffer == None) {
printf("Error: couldn't create pbuffer\n");
XCloseDisplay(gDpy);
return 0;
@@ -186,7 +186,7 @@ Setup(int width, int height)
return 0;
}
- return 1; /* Success!! */
+ return 1; /* Success!! */
#else
printf("Error: GLX version 1.3 or 1.4 not available at compile time\n");
return 0;
@@ -208,13 +208,12 @@ InitGL(void)
glEnable(GL_CULL_FACE);
glViewport(0, 0, gWidth, gHeight);
- glMatrixMode( GL_PROJECTION );
+ glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
+ glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
+ glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
-
+ glTranslatef(0.0, 0.0, -15.0);
}
@@ -244,8 +243,7 @@ static void
drawBox(GLfloat x0, GLfloat x1, GLfloat y0, GLfloat y1,
GLfloat z0, GLfloat z1, GLenum type)
{
- static GLfloat n[6][3] =
- {
+ static GLfloat n[6][3] = {
{-1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{1.0, 0.0, 0.0},
@@ -253,8 +251,7 @@ drawBox(GLfloat x0, GLfloat x1, GLfloat y0, GLfloat y1,
{0.0, 0.0, 1.0},
{0.0, 0.0, -1.0}
};
- static GLint faces[6][4] =
- {
+ static GLint faces[6][4] = {
{0, 1, 2, 3},
{3, 2, 6, 7},
{7, 6, 5, 4},
@@ -311,10 +308,10 @@ Render(void)
glClearColor(0.2, 0.2, 0.9, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- for (i=0;i<NumBoxes;i++) {
+ for (i = 0; i < NumBoxes; i++) {
float tx = -2.0 + 4.0 * Random();
float ty = -2.0 + 4.0 * Random();
- float tz = 4.0 - 16.0 * Random();
+ float tz = 4.0 - 16.0 * Random();
float sx = 0.1 + Random() * 0.4;
float sy = 0.1 + Random() * 0.4;
float sz = 0.1 + Random() * 0.4;
@@ -357,22 +354,22 @@ WriteFile(const char *filename)
printf("Couldn't open image file: %s\n", filename);
return;
}
- fprintf(f,"P6\n");
- fprintf(f,"# ppm-file created by %s\n", "trdemo2");
- fprintf(f,"%i %i\n", gWidth, gHeight);
- fprintf(f,"255\n");
+ fprintf(f, "P6\n");
+ fprintf(f, "# ppm-file created by %s\n", "trdemo2");
+ fprintf(f, "%i %i\n", gWidth, gHeight);
+ fprintf(f, "255\n");
fclose(f);
- f = fopen(filename, "ab"); /* now append binary data */
+ f = fopen(filename, "ab"); /* now append binary data */
if (!f) {
printf("Couldn't append to image file: %s\n", filename);
return;
}
- for (i=0;i<gHeight;i++) {
+ for (i = 0; i < gHeight; i++) {
GLubyte *rowPtr;
/* Remember, OpenGL images are bottom to top. Have to reverse. */
- rowPtr = image + (gHeight-1-i) * gWidth*3;
- fwrite(rowPtr, 1, gWidth*3, f);
+ rowPtr = image + (gHeight - 1 - i) * gWidth * 3;
+ fwrite(rowPtr, 1, gWidth * 3, f);
}
fclose(f);
@@ -399,18 +396,18 @@ Usage(const char *appName)
int
main(int argc, char *argv[])
{
- if (argc!=4) {
+ if (argc != 4) {
Usage(argv[0]);
}
else {
int width = atoi(argv[1]);
int height = atoi(argv[2]);
char *fileName = argv[3];
- if (width<=0) {
+ if (width <= 0) {
printf("Error: width parameter must be at least 1.\n");
return 1;
}
- if (height<=0) {
+ if (height <= 0) {
printf("Error: height parameter must be at least 1.\n");
return 1;
}
@@ -424,7 +421,7 @@ main(int argc, char *argv[])
WriteFile(fileName);
printf("File write completed.\n");
- glXDestroyPbuffer( gDpy, gPBuffer );
+ glXDestroyPbuffer(gDpy, gPBuffer);
}
return 0;
}
diff --git a/src/xdemos/glxpixmap.c b/src/xdemos/glxpixmap.c
index 12ba59be..7b96fc52 100644
--- a/src/xdemos/glxpixmap.c
+++ b/src/xdemos/glxpixmap.c
@@ -42,12 +42,12 @@ make_rgb_window(Display *dpy,
Window root;
Window win;
- scrnum = DefaultScreen( dpy );
- root = RootWindow( dpy, scrnum );
+ scrnum = DefaultScreen(dpy);
+ root = RootWindow(dpy, scrnum);
- visinfo = glXChooseVisual( dpy, scrnum, (int *) sbAttrib );
+ visinfo = glXChooseVisual(dpy, scrnum, (int *) sbAttrib);
if (!visinfo) {
- visinfo = glXChooseVisual( dpy, scrnum, (int *) dbAttrib );
+ visinfo = glXChooseVisual(dpy, scrnum, (int *) dbAttrib);
if (!visinfo) {
printf("Error: couldn't get an RGB visual\n");
exit(1);
@@ -58,19 +58,19 @@ make_rgb_window(Display *dpy,
attr.background_pixel = 0;
attr.border_pixel = 0;
/* TODO: share root colormap if possible */
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
- win = XCreateWindow( dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
+ win = XCreateWindow(dpy, root, 0, 0, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr);
/* make an X GC so we can do XCopyArea later */
- gc = XCreateGC( dpy, win, 0, NULL );
+ gc = XCreateGC(dpy, win, 0, NULL);
/* need indirect context */
- ctx = glXCreateContext( dpy, visinfo, NULL, False );
+ ctx = glXCreateContext(dpy, visinfo, NULL, False);
if (!ctx) {
printf("Error: glXCreateContext failed\n");
exit(-1);
@@ -91,13 +91,13 @@ make_pixmap(Display *dpy, Window win,
GLXPixmap glxpm;
XWindowAttributes attr;
- pm = XCreatePixmap( dpy, win, width, height, visinfo->depth );
+ pm = XCreatePixmap(dpy, win, width, height, visinfo->depth);
if (!pm) {
printf("Error: XCreatePixmap failed\n");
exit(-1);
}
- XGetWindowAttributes( dpy, win, &attr );
+ XGetWindowAttributes(dpy, win, &attr);
/*
* IMPORTANT:
@@ -112,14 +112,14 @@ make_pixmap(Display *dpy, Window win,
PFNGLXCREATEGLXPIXMAPMESAPROC glXCreateGLXPixmapMESA_func =
(PFNGLXCREATEGLXPIXMAPMESAPROC)
glXGetProcAddressARB((GLubyte *) "glXCreateGLXPixmapMESA");
- glxpm = glXCreateGLXPixmapMESA_func( dpy, visinfo, pm, attr.colormap );
+ glxpm = glXCreateGLXPixmapMESA_func(dpy, visinfo, pm, attr.colormap);
}
else {
- glxpm = glXCreateGLXPixmap( dpy, visinfo, pm );
+ glxpm = glXCreateGLXPixmap(dpy, visinfo, pm);
}
#else
/* This will work with Mesa too if the visual is TrueColor or DirectColor */
- glxpm = glXCreateGLXPixmap( dpy, visinfo, pm );
+ glxpm = glXCreateGLXPixmap(dpy, visinfo, pm);
#endif
if (!glxpm) {
@@ -139,15 +139,15 @@ event_loop(Display *dpy, GLXPixmap pm)
XEvent event;
while (1) {
- XNextEvent( dpy, &event );
+ XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
printf("Redraw\n");
/* copy the image from GLXPixmap to window */
- XCopyArea( dpy, pm, event.xany.window, /* src, dest */
- gc, 0, 0, 300, 300, /* gc, src pos, size */
- 0, 0 ); /* dest pos */
+ XCopyArea(dpy, pm, event.xany.window, /* src, dest */
+ gc, 0, 0, 300, 300, /* gc, src pos, size */
+ 0, 0); /* dest pos */
break;
case ConfigureNotify:
/* nothing */
@@ -168,25 +168,25 @@ main(int argc, char *argv[])
dpy = XOpenDisplay(NULL);
- win = make_rgb_window( dpy, 300, 300 );
- glxpm = make_pixmap( dpy, win, 300, 300, &pm );
+ win = make_rgb_window(dpy, 300, 300);
+ glxpm = make_pixmap(dpy, win, 300, 300, &pm);
- glXMakeCurrent( dpy, glxpm, ctx );
+ glXMakeCurrent(dpy, glxpm, ctx);
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
/* Render an image into the pixmap */
- glShadeModel( GL_FLAT );
- glClearColor( 0.5, 0.5, 0.5, 1.0 );
- glClear( GL_COLOR_BUFFER_BIT );
- glViewport( 0, 0, 300, 300 );
- glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
- glColor3f( 0.0, 1.0, 1.0 );
- glRectf( -0.75, -0.75, 0.75, 0.75 );
+ glShadeModel(GL_FLAT);
+ glClearColor(0.5, 0.5, 0.5, 1.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ glViewport(0, 0, 300, 300);
+ glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
+ glColor3f(0.0, 1.0, 1.0);
+ glRectf(-0.75, -0.75, 0.75, 0.75);
glFlush();
glXWaitGL();
- XMapWindow( dpy, win );
+ XMapWindow(dpy, win);
- event_loop( dpy, pm );
+ event_loop(dpy, pm);
return 0;
}
diff --git a/src/xdemos/glxsnoop.c b/src/xdemos/glxsnoop.c
index a4d14c38..2b8beaec 100644
--- a/src/xdemos/glxsnoop.c
+++ b/src/xdemos/glxsnoop.c
@@ -55,10 +55,10 @@ redraw(Display *dpy, Window srcWin, Window dstWin)
int i;
glReadPixels(0, 0, Width, Height, GL_DEPTH_COMPONENT, GL_FLOAT, z);
for (i = 0; i < Width * Height; i++) {
- image[i*4+0] =
- image[i*4+1] =
- image[i*4+2] = (GLint) (255.0 * z[i]);
- image[i*4+3] = 255;
+ image[i * 4 + 0] =
+ image[i * 4 + 1] =
+ image[i * 4 + 2] = (GLint) (255.0 * z[i]);
+ image[i * 4 + 3] = 255;
}
free(z);
}
@@ -82,10 +82,10 @@ redraw(Display *dpy, Window srcWin, Window dstWin)
else
step = 255.0 / (float) (max - min);
for (i = 0; i < Width * Height; i++) {
- image[i*4+0] =
- image[i*4+1] =
- image[i*4+2] = (GLint) ((sten[i] - min) * step);
- image[i*4+3] = 255;
+ image[i * 4 + 0] =
+ image[i * 4 + 1] =
+ image[i * 4 + 2] = (GLint) ((sten[i] - min) * step);
+ image[i * 4 + 3] = 255;
}
free(sten);
}
@@ -121,26 +121,26 @@ make_gl_window(Display *dpy, XVisualInfo *visinfo, int width, int height)
int x = 0, y = 0;
char *name = NULL;
- scrnum = DefaultScreen( dpy );
- root = RootWindow( dpy, scrnum );
+ scrnum = DefaultScreen(dpy);
+ root = RootWindow(dpy, scrnum);
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
- win = XCreateWindow( dpy, root, x, y, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
+ win = XCreateWindow(dpy, root, x, y, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr);
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
@@ -215,7 +215,7 @@ event_loop(Display *dpy, Window win)
XEvent event;
while (1) {
- XNextEvent( dpy, &event );
+ XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
@@ -362,7 +362,7 @@ main(int argc, char *argv[])
visinfo = visualid_to_visualinfo(dpy, vid);
- Context = glXCreateContext( dpy, visinfo, NULL, True );
+ Context = glXCreateContext(dpy, visinfo, NULL, True);
if (!Context) {
printf("Error: glXCreateContext failed\n");
exit(1);
@@ -372,7 +372,7 @@ main(int argc, char *argv[])
XMapWindow(dpy, win);
update_window_title(dpy, win);
- event_loop( dpy, win );
+ event_loop(dpy, win);
return 0;
}
diff --git a/src/xdemos/glxswapcontrol.c b/src/xdemos/glxswapcontrol.c
index 6e5ef015..3b17161d 100644
--- a/src/xdemos/glxswapcontrol.c
+++ b/src/xdemos/glxswapcontrol.c
@@ -44,23 +44,23 @@
#ifndef __VMS
/*# include <stdint.h>*/
#endif
-# define GLX_GLXEXT_PROTOTYPES
+#define GLX_GLXEXT_PROTOTYPES
#include <GL/gl.h>
#include <GL/glx.h>
#ifndef GLX_MESA_swap_control
-typedef GLint ( * PFNGLXSWAPINTERVALMESAPROC) (unsigned interval);
-typedef GLint ( * PFNGLXGETSWAPINTERVALMESAPROC) ( void );
+typedef GLint (*PFNGLXSWAPINTERVALMESAPROC)(unsigned interval);
+typedef GLint (*PFNGLXGETSWAPINTERVALMESAPROC)(void);
#endif
-#if !defined( GLX_OML_sync_control ) && defined( _STDINT_H )
+#if !defined(GLX_OML_sync_control) && defined(_STDINT_H)
#define GLX_OML_sync_control 1
-typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
+typedef Bool (*PFNGLXGETMSCRATEOMLPROC)(Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
#endif
#ifndef GLX_MESA_swap_frame_usage
#define GLX_MESA_swap_frame_usage 1
-typedef int ( * PFNGLXGETFRAMEUSAGEMESAPROC) (Display *dpy, GLXDrawable drawable, float * usage );
+typedef int (*PFNGLXGETFRAMEUSAGEMESAPROC)(Display *dpy, GLXDrawable drawable, float *usage);
#endif
#define BENCHMARK
@@ -82,7 +82,7 @@ current_time(void)
{
struct timeval tv;
#ifdef __VMS
- (void) gettimeofday(&tv, NULL );
+ (void) gettimeofday(&tv, NULL);
#else
struct timezone tz;
(void) gettimeofday(&tv, &tz);
@@ -111,7 +111,7 @@ static GLboolean has_SGI_swap_control = GL_FALSE;
static GLboolean has_MESA_swap_control = GL_FALSE;
static GLboolean has_MESA_swap_frame_usage = GL_FALSE;
-static char ** extension_table = NULL;
+static char **extension_table = NULL;
static unsigned num_extensions;
static GLboolean use_ztrick = GL_FALSE;
@@ -259,7 +259,7 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
static void
draw(void)
{
- if ( use_ztrick ) {
+ if (use_ztrick) {
static GLboolean flip = GL_FALSE;
static const GLfloat vert[4][3] = {
{ -1, -1, -0.999 },
@@ -274,7 +274,7 @@ draw(void)
{ 0.0, 0.0, 0.0 },
};
- if ( flip ) {
+ if (flip) {
glDepthRange(0, 0.5);
glDepthFunc(GL_LEQUAL);
}
@@ -297,13 +297,13 @@ draw(void)
glDisable(GL_LIGHTING);
glShadeModel(GL_SMOOTH);
- glEnableClientState( GL_VERTEX_ARRAY );
- glEnableClientState( GL_COLOR_ARRAY );
- glVertexPointer( 3, GL_FLOAT, 0, vert );
- glColorPointer( 3, GL_FLOAT, 0, col );
- glDrawArrays( GL_POLYGON, 0, 4 );
- glDisableClientState( GL_COLOR_ARRAY );
- glDisableClientState( GL_VERTEX_ARRAY );
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_COLOR_ARRAY);
+ glVertexPointer(3, GL_FLOAT, 0, vert);
+ glColorPointer(3, GL_FLOAT, 0, col);
+ glDrawArrays(GL_POLYGON, 0, 4);
+ glDisableClientState(GL_COLOR_ARRAY);
+ glDisableClientState(GL_VERTEX_ARRAY);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -434,7 +434,7 @@ no_border(Display *dpy, Window w)
motif_hints.decorations = flags;
/* get the atom for the property */
- prop = XInternAtom( dpy, "_MOTIF_WM_HINTS", True );
+ prop = XInternAtom(dpy, "_MOTIF_WM_HINTS", True);
if (!prop) {
/* something went wrong! */
return;
@@ -443,13 +443,13 @@ no_border(Display *dpy, Window w)
/* not sure this is correct, seems to work, XA_WM_HINTS didn't work */
proptype = prop;
- XChangeProperty( dpy, w, /* display, window */
- prop, proptype, /* property, type */
- 32, /* format: 32-bit datums */
- PropModeReplace, /* mode */
- (unsigned char *) &motif_hints, /* data */
- PROP_MOTIF_WM_HINTS_ELEMENTS /* nelements */
- );
+ XChangeProperty(dpy, w, /* display, window */
+ prop, proptype, /* property, type */
+ 32, /* format: 32-bit datums */
+ PropModeReplace, /* mode */
+ (unsigned char *) &motif_hints, /* data */
+ PROP_MOTIF_WM_HINTS_ELEMENTS /* nelements */
+ );
}
@@ -476,16 +476,16 @@ make_window(Display *dpy, const char *name, int x, int y, int width, int height,
GLXContext ctx;
XVisualInfo *visinfo;
- scrnum = DefaultScreen( dpy );
- root = RootWindow( dpy, scrnum );
+ scrnum = DefaultScreen(dpy);
+ root = RootWindow(dpy, scrnum);
if (fullscreen) {
x = y = 0;
- width = DisplayWidth( dpy, scrnum );
- height = DisplayHeight( dpy, scrnum );
+ width = DisplayWidth(dpy, scrnum);
+ height = DisplayHeight(dpy, scrnum);
}
- visinfo = glXChooseVisual( dpy, scrnum, attrib );
+ visinfo = glXChooseVisual(dpy, scrnum, attrib);
if (!visinfo) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
@@ -494,20 +494,20 @@ make_window(Display *dpy, const char *name, int x, int y, int width, int height,
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
- win = XCreateWindow( dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
+ win = XCreateWindow(dpy, root, 0, 0, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr);
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
@@ -518,7 +518,7 @@ make_window(Display *dpy, const char *name, int x, int y, int width, int height,
if (fullscreen)
no_border(dpy, win);
- ctx = glXCreateContext( dpy, visinfo, NULL, True );
+ ctx = glXCreateContext(dpy, visinfo, NULL, True);
if (!ctx) {
printf("Error: glXCreateContext failed\n");
exit(1);
@@ -534,7 +534,7 @@ make_window(Display *dpy, const char *name, int x, int y, int width, int height,
static void
event_loop(Display *dpy, Window win)
{
- float frame_usage = 0.0;
+ float frame_usage = 0.0;
while (1) {
while (XPending(dpy) > 0) {
@@ -583,10 +583,10 @@ event_loop(Display *dpy, Window win)
glXSwapBuffers(dpy, win);
- if ( get_frame_usage != NULL ) {
- GLfloat temp;
+ if (get_frame_usage != NULL) {
+ GLfloat temp;
- (*get_frame_usage)( dpy, win, & temp );
+ (*get_frame_usage)(dpy, win, &temp);
frame_usage += temp;
}
@@ -604,7 +604,7 @@ event_loop(Display *dpy, Window win)
if (t - t0 >= 5.0) {
GLfloat seconds = t - t0;
GLfloat fps = frames / seconds;
- if ( get_frame_usage != NULL ) {
+ if (get_frame_usage != NULL) {
printf("%d frames in %3.1f seconds = %6.3f FPS (%3.1f%% usage)\n",
frames, seconds, fps,
(frame_usage * 100.0) / (float) frames );
@@ -639,11 +639,11 @@ show_refresh_rate(Display *dpy)
get_msc_rate = (PFNGLXGETMSCRATEOMLPROC) glXGetProcAddressARB( (const GLubyte *) "glXGetMscRateOML" );
if ( get_msc_rate != NULL ) {
(*get_msc_rate)( dpy, glXGetCurrentDrawable(), &n, &d );
- printf( "refresh rate: %.1fHz\n", (float) n / d );
+ printf("refresh rate: %.1fHz\n", (float) n / d);
return;
}
#endif
- printf( "glXGetMscRateOML not supported.\n" );
+ printf("glXGetMscRateOML not supported.\n");
}
@@ -657,63 +657,63 @@ show_refresh_rate(Display *dpy)
static void
make_extension_table(const char *string)
{
- char ** string_tab;
- unsigned num_strings;
- unsigned base;
- unsigned idx;
- unsigned i;
+ char **string_tab;
+ unsigned num_strings;
+ unsigned base;
+ unsigned idx;
+ unsigned i;
/* Count the number of spaces in the string. That gives a base-line
* figure for the number of extension in the string.
*/
num_strings = 1;
- for ( i = 0 ; string[i] != NUL ; i++ ) {
- if ( string[i] == ' ' ) {
+ for (i = 0; string[i] != NUL; i++) {
+ if (string[i] == ' ') {
num_strings++;
}
}
- string_tab = (char **) malloc( sizeof( char * ) * num_strings );
- if ( string_tab == NULL ) {
+ string_tab = (char **) malloc(sizeof(char *) * num_strings);
+ if (string_tab == NULL) {
return;
}
base = 0;
idx = 0;
- while ( string[ base ] != NUL ) {
+ while (string[base] != NUL) {
/* Determine the length of the next extension string.
*/
- for ( i = 0
- ; (string[ base + i ] != NUL) && (string[ base + i ] != ' ')
- ; i++ ) {
+ for (i = 0
+ ; (string[ base + i ] != NUL) && (string[ base + i ] != ' ')
+ ; i++) {
/* empty */ ;
}
- if ( i > 0 ) {
+ if (i > 0) {
/* If the string was non-zero length, add it to the table. We
* can get zero length strings if there is a space at the end of
* the string or if there are two (or more) spaces next to each
* other in the string.
*/
- string_tab[ idx ] = malloc( sizeof( char ) * (i + 1) );
- if ( string_tab[ idx ] == NULL ) {
+ string_tab[idx] = malloc(sizeof(char) * (i + 1));
+ if (string_tab[idx] == NULL) {
unsigned j = 0;
- for ( j = 0; j < idx; j++ ) {
- free( string_tab[j] );
+ for (j = 0; j < idx; j++) {
+ free(string_tab[j]);
}
- free( string_tab );
+ free(string_tab);
return;
}
- (void) memcpy( string_tab[ idx ], & string[ base ], i );
- string_tab[ idx ][i] = NUL;
+ (void) memcpy(string_tab[idx], &string[base], i);
+ string_tab[idx][i] = NUL;
idx++;
}
@@ -721,10 +721,10 @@ make_extension_table(const char *string)
/* Skip to the start of the next extension string.
*/
- for ( base += i
- ; (string[ base ] == ' ') && (string[ base ] != NUL)
- ; base++ ) {
- /* empty */ ;
+ for (base += i
+ ; (string[base] == ' ') && (string[base] != NUL)
+ ; base++) {
+ /* empty */;
}
}
@@ -744,10 +744,10 @@ make_extension_table(const char *string)
static GLboolean
is_extension_supported(const char *ext)
{
- unsigned i;
+ unsigned i;
- for ( i = 0 ; i < num_extensions ; i++ ) {
- if ( strcmp( ext, extension_table[i] ) == 0 ) {
+ for (i = 0; i < num_extensions; i++) {
+ if (strcmp(ext, extension_table[i]) == 0) {
return GL_TRUE;
}
}
@@ -775,14 +775,14 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0 && i + 1 < argc) {
- dpyName = argv[i+1];
+ dpyName = argv[i + 1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else if (strcmp(argv[i], "-swap") == 0 && i + 1 < argc) {
- swap_interval = atoi( argv[i+1] );
+ swap_interval = atoi(argv[i + 1]);
do_swap_interval = GL_TRUE;
i++;
}
@@ -823,23 +823,22 @@ main(int argc, char *argv[])
XMapWindow(dpy, win);
glXMakeCurrent(dpy, win, ctx);
- make_extension_table( (char *) glXQueryExtensionsString(dpy,DefaultScreen(dpy)) );
- has_OML_sync_control = is_extension_supported( "GLX_OML_sync_control" );
- has_SGI_swap_control = is_extension_supported( "GLX_SGI_swap_control" );
- has_MESA_swap_control = is_extension_supported( "GLX_MESA_swap_control" );
- has_MESA_swap_frame_usage = is_extension_supported( "GLX_MESA_swap_frame_usage" );
+ make_extension_table((char *) glXQueryExtensionsString(dpy, DefaultScreen(dpy)));
+ has_OML_sync_control = is_extension_supported("GLX_OML_sync_control");
+ has_SGI_swap_control = is_extension_supported("GLX_SGI_swap_control");
+ has_MESA_swap_control = is_extension_supported("GLX_MESA_swap_control");
+ has_MESA_swap_frame_usage = is_extension_supported("GLX_MESA_swap_frame_usage");
- if ( has_MESA_swap_control ) {
+ if (has_MESA_swap_control) {
set_swap_interval = (PFNGLXSWAPINTERVALMESAPROC) glXGetProcAddressARB( (const GLubyte *) "glXSwapIntervalMESA" );
get_swap_interval = (PFNGLXGETSWAPINTERVALMESAPROC) glXGetProcAddressARB( (const GLubyte *) "glXGetSwapIntervalMESA" );
}
- else if ( has_SGI_swap_control ) {
+ else if (has_SGI_swap_control) {
set_swap_interval = (PFNGLXSWAPINTERVALMESAPROC) glXGetProcAddressARB( (const GLubyte *) "glXSwapIntervalSGI" );
}
-
- if ( has_MESA_swap_frame_usage ) {
- get_frame_usage = (PFNGLXGETFRAMEUSAGEMESAPROC) glXGetProcAddressARB( (const GLubyte *) "glXGetFrameUsageMESA" );
+ if (has_MESA_swap_frame_usage) {
+ get_frame_usage = (PFNGLXGETFRAMEUSAGEMESAPROC) glXGetProcAddressARB((const GLubyte *) "glXGetFrameUsageMESA");
}
@@ -848,33 +847,33 @@ main(int argc, char *argv[])
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
- if ( has_OML_sync_control || force_get_rate ) {
- show_refresh_rate( dpy );
+ if (has_OML_sync_control || force_get_rate) {
+ show_refresh_rate(dpy);
}
- if ( get_swap_interval != NULL ) {
- printf("Default swap interval = %d\n", (*get_swap_interval)() );
+ if (get_swap_interval != NULL) {
+ printf("Default swap interval = %d\n", (*get_swap_interval)());
}
}
- if ( do_swap_interval ) {
- if ( set_swap_interval != NULL ) {
- if ( ((swap_interval == 0) && !has_MESA_swap_control)
- || (swap_interval < 0) ) {
+ if (do_swap_interval) {
+ if (set_swap_interval != NULL) {
+ if (((swap_interval == 0) && !has_MESA_swap_control)
+ || (swap_interval < 0)) {
printf( "Swap interval must be non-negative or greater than zero "
"if GLX_MESA_swap_control is not supported.\n" );
}
else {
- (*set_swap_interval)( swap_interval );
+ (*set_swap_interval)(swap_interval);
}
- if ( printInfo && (get_swap_interval != NULL) ) {
- printf("Current swap interval = %d\n", (*get_swap_interval)() );
+ if (printInfo && (get_swap_interval != NULL)) {
+ printf("Current swap interval = %d\n", (*get_swap_interval)());
}
}
else {
printf("Unable to set swap-interval. Neither GLX_SGI_swap_control "
- "nor GLX_MESA_swap_control are supported.\n" );
+ "nor GLX_MESA_swap_control are supported.\n");
}
}
diff --git a/src/xdemos/manywin.c b/src/xdemos/manywin.c
index f99a1f85..d917908b 100644
--- a/src/xdemos/manywin.c
+++ b/src/xdemos/manywin.c
@@ -124,7 +124,7 @@ AddHead(const char *displayName, const char *name)
XSizeHints sizehints;
sizehints.x = xpos;
sizehints.y = ypos;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
@@ -177,7 +177,7 @@ AddHead(const char *displayName, const char *name)
/* save the info for this head */
{
struct head *h = &Heads[NumHeads];
- const char * tmp;
+ const char *tmp;
if (strlen(name) + 1 > sizeof(h->DisplayName)) {
Error(displayName, "name string overflow");
@@ -212,7 +212,7 @@ AddHead(const char *displayName, const char *name)
strcpy(h->Renderer, tmp);
NumHeads++;
- return &Heads[NumHeads-1];
+ return &Heads[NumHeads - 1];
}
}
@@ -391,7 +391,7 @@ main(int argc, char *argv[])
SwapSeparate = GL_FALSE;
}
else if (strcmp(argv[i], "-display") == 0 && i < argc) {
- dpyName = argv[i+1];
+ dpyName = argv[i + 1];
i++;
}
else {
diff --git a/src/xdemos/msctest.c b/src/xdemos/msctest.c
index 6f7ad7dd..fddc3c69 100644
--- a/src/xdemos/msctest.c
+++ b/src/xdemos/msctest.c
@@ -149,7 +149,7 @@ main(int argc, char *argv[])
while (i++) {
get_sync_values(disp, winGL, &ust, &msc, &sbc);
- fprintf(stderr, "ust: %"PRId64", msc: %"PRId64", sbc: %"PRId64"\n",
+ fprintf(stderr, "ust: %" PRId64 ", msc: %" PRId64 ", sbc: %" PRId64 "\n",
ust, msc, sbc);
/* Alternate colors to make tearing obvious */
diff --git a/src/xdemos/multictx.c b/src/xdemos/multictx.c
index 1e1972fb..a08de51c 100644
--- a/src/xdemos/multictx.c
+++ b/src/xdemos/multictx.c
@@ -50,7 +50,7 @@ static GLfloat view_rotx = 0.0, view_roty = 210.0, view_rotz = 0.0;
static GLint gear1, gear2;
static GLfloat angle = 0.0;
-static GLboolean animate = GL_TRUE; /* Animation */
+static GLboolean animate = GL_TRUE; /* Animation */
static double
@@ -58,7 +58,7 @@ current_time(void)
{
struct timeval tv;
#ifdef __VMS
- (void) gettimeofday(&tv, NULL );
+ (void) gettimeofday(&tv, NULL);
#else
struct timezone tz;
(void) gettimeofday(&tv, &tz);
@@ -254,7 +254,7 @@ draw_frame(Display *dpy, Window win, GLXContext ctx1, GLXContext ctx2)
if (animate) {
/* advance rotation for next frame */
- angle += 70.0 * dt; /* 70 degrees per second */
+ angle += 70.0 * dt; /* 70 degrees per second */
if (angle > 3600.0)
angle -= 3600.0;
}
@@ -307,9 +307,9 @@ reshape(Display *dpy, Window win,
static void
init(Display *dpy, Window win, GLXContext ctx1, GLXContext ctx2)
{
- static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 };
- static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
- static GLfloat green[4] = { 0.0, 0.8, 0.2, 0.5 };
+ static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0};
+ static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
+ static GLfloat green[4] = {0.0, 0.8, 0.2, 0.5};
/*static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };*/
/* first ctx */
@@ -397,10 +397,10 @@ make_window_and_contexts(Display *dpy, const char *name, int x, int y,
Window win;
XVisualInfo *visinfo;
- scrnum = DefaultScreen( dpy );
- root = RootWindow( dpy, scrnum );
+ scrnum = DefaultScreen(dpy);
+ root = RootWindow(dpy, scrnum);
- visinfo = glXChooseVisual( dpy, scrnum, attribs );
+ visinfo = glXChooseVisual(dpy, scrnum, attribs);
if (!visinfo) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
@@ -409,20 +409,20 @@ make_window_and_contexts(Display *dpy, const char *name, int x, int y,
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
- win = XCreateWindow( dpy, root, x, y, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
+ win = XCreateWindow(dpy, root, x, y, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr);
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
@@ -431,8 +431,8 @@ make_window_and_contexts(Display *dpy, const char *name, int x, int y,
}
*winRet = win;
- *ctxRet1 = glXCreateContext( dpy, visinfo, NULL, True );
- *ctxRet2 = glXCreateContext( dpy, visinfo, NULL, True );
+ *ctxRet1 = glXCreateContext(dpy, visinfo, NULL, True);
+ *ctxRet2 = glXCreateContext(dpy, visinfo, NULL, True);
if (!*ctxRet1 || !*ctxRet2) {
printf("Error: glXCreateContext failed\n");
@@ -530,7 +530,7 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
- dpyName = argv[i+1];
+ dpyName = argv[i + 1];
i++;
}
else {
diff --git a/src/xdemos/offset.c b/src/xdemos/offset.c
index 194080bb..2125b1c3 100644
--- a/src/xdemos/offset.c
+++ b/src/xdemos/offset.c
@@ -52,12 +52,11 @@ PERFORMANCE OF THIS SOFTWARE.
#include <stdio.h>
#include <string.h>
-
#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
+#define EXIT_FAILURE 1
#endif
#ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
+#define EXIT_SUCCESS 0
#endif
#define MAXQUAD 6
@@ -76,8 +75,8 @@ Quad quads[MAXQUAD] = {
{ {0,0,1}, {1,0,1}, {1,1,1}, {0,1,1} } /* z = 1 */
};
-#define WIREFRAME 0
-#define HIDDEN_LINE 1
+#define WIREFRAME 0
+#define HIDDEN_LINE 1
static void
error(const char *prog, const char *msg);
@@ -119,10 +118,12 @@ main(int argc, char **argv)
GLint z;
dpy = XOpenDisplay(0);
- if (!dpy) error(argv[0], "can't open display");
+ if (!dpy)
+ error(argv[0], "can't open display");
vi = glXChooseVisual(dpy, DefaultScreen(dpy), attributeList);
- if (!vi) error(argv[0], "no suitable visual");
+ if (!vi)
+ error(argv[0], "no suitable visual");
cx = glXCreateContext(dpy, vi, 0, GL_TRUE);
@@ -153,13 +154,14 @@ main(int argc, char **argv)
printf("GL_DEPTH_BITS = %d\n", z);
printf("using 1.1 offset\n");
- glPolygonOffset( 1.0, 0.5 );
+ glPolygonOffset(1.0, 0.5);
- glShadeModel( GL_FLAT );
- glDisable( GL_DITHER );
+ glShadeModel(GL_FLAT);
+ glDisable(GL_DITHER);
/* process events until the user presses ESC */
- while (1) process_input(dpy, win);
+ while (1)
+ process_input(dpy, win);
return 0;
}
@@ -200,7 +202,7 @@ cubes(int mx, int my, int mode)
/* draw the lines as hidden polygons */
glTranslatef(-0.5, -0.5, -0.5);
- glScalef(1.0/dimension, 1.0/dimension, 1.0/dimension);
+ glScalef(1.0 / dimension, 1.0 / dimension, 1.0 / dimension);
for (z = 0; z < dimension; z++) {
for (y = 0; y < dimension; y++) {
for (x = 0; x < dimension; x++) {
@@ -269,7 +271,7 @@ process_input(Display *dpy, Window win)
KeySym keysym;
XNextEvent(dpy, &event);
- switch(event.type) {
+ switch (event.type) {
case Expose:
break;
case ConfigureNotify: {
diff --git a/src/xdemos/omlsync.c b/src/xdemos/omlsync.c
index d0c7cab5..7c5c039d 100644
--- a/src/xdemos/omlsync.c
+++ b/src/xdemos/omlsync.c
@@ -201,7 +201,7 @@ main(int argc, char *argv[])
sizehints.x = 0;
sizehints.y = 0;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
diff --git a/src/xdemos/opencloseopen.c b/src/xdemos/opencloseopen.c
index 142400ca..0a02a988 100644
--- a/src/xdemos/opencloseopen.c
+++ b/src/xdemos/opencloseopen.c
@@ -58,11 +58,12 @@ draw(void)
glRotatef(0, 0, 0, 1);
glBegin(GL_POLYGON);
glVertex2f(-0.5, -0.25);
- glVertex2f( 0.5, -0.25);
- glVertex2f( 0.5, 0.25);
+ glVertex2f(0.5, -0.25);
+ glVertex2f(0.5, 0.25);
glVertex2f(-0.5, 0.25);
glEnd();
- glPopMatrix();}
+ glPopMatrix();
+}
/*
@@ -95,10 +96,10 @@ make_window(const char *dpyName, const char *name, int x, int y, int width,
}
*dpyRet = dpy;
- scrnum = DefaultScreen( dpy );
- root = RootWindow( dpy, scrnum );
+ scrnum = DefaultScreen(dpy);
+ root = RootWindow(dpy, scrnum);
- visinfo = glXChooseVisual( dpy, scrnum, attrib );
+ visinfo = glXChooseVisual(dpy, scrnum, attrib);
if (!visinfo) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
@@ -107,20 +108,20 @@ make_window(const char *dpyName, const char *name, int x, int y, int width,
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
- win = XCreateWindow( dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
+ win = XCreateWindow(dpy, root, 0, 0, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr);
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
@@ -128,7 +129,7 @@ make_window(const char *dpyName, const char *name, int x, int y, int width,
None, (char **)NULL, 0, &sizehints);
}
- ctx = glXCreateContext( dpy, visinfo, NULL, True );
+ ctx = glXCreateContext(dpy, visinfo, NULL, True);
if (!ctx) {
printf("Error: glXCreateContext failed\n");
exit(1);
@@ -162,7 +163,7 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
- dpyName = argv[i+1];
+ dpyName = argv[i + 1];
i++;
}
}
diff --git a/src/xdemos/pbdemo.c b/src/xdemos/pbdemo.c
index 2a34a7de..f727fd38 100644
--- a/src/xdemos/pbdemo.c
+++ b/src/xdemos/pbdemo.c
@@ -125,11 +125,11 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
int i;
int attempt;
- for (attempt=0; attempt<NUM_FB_CONFIGS; attempt++) {
+ for (attempt = 0; attempt < NUM_FB_CONFIGS; attempt++) {
/* Get list of possible frame buffer configurations */
fbConfigs = ChooseFBConfig(dpy, screen, fbAttribs[attempt], &nConfigs);
- if (nConfigs==0 || !fbConfigs) {
+ if (nConfigs == 0 || !fbConfigs) {
printf("Note: glXChooseFBConfig(%s) failed\n", fbString[attempt]);
XFree(fbConfigs);
continue;
@@ -143,7 +143,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
#endif
/* Create the pbuffer using first fbConfig in the list that works. */
- for (i=0;i<nConfigs;i++) {
+ for (i = 0; i < nConfigs; i++) {
pBuffer = CreatePbuffer(dpy, screen, fbConfigs[i], width, height, largest, preserve);
if (pBuffer) {
gFBconfig = fbConfigs[i];
@@ -153,7 +153,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
}
}
- if (pBuffer!=None) {
+ if (pBuffer != None) {
break;
}
}
@@ -204,8 +204,8 @@ Setup(int width, int height)
}
/* Create Pbuffer */
- gPBuffer = MakePbuffer( gDpy, gScreen, width, height );
- if (gPBuffer==None) {
+ gPBuffer = MakePbuffer(gDpy, gScreen, width, height);
+ if (gPBuffer == None) {
printf("Error: couldn't create pbuffer\n");
XCloseDisplay(gDpy);
return 0;
@@ -214,15 +214,15 @@ Setup(int width, int height)
/* Test drawable queries */
{
unsigned int v;
- glXQueryDrawable( gDpy, gPBuffer, GLX_WIDTH, &v);
+ glXQueryDrawable(gDpy, gPBuffer, GLX_WIDTH, &v);
printf("GLX_WIDTH = %u\n", v);
- glXQueryDrawable( gDpy, gPBuffer, GLX_HEIGHT, &v);
+ glXQueryDrawable(gDpy, gPBuffer, GLX_HEIGHT, &v);
printf("GLX_HEIGHT = %u\n", v);
- glXQueryDrawable( gDpy, gPBuffer, GLX_PRESERVED_CONTENTS, &v);
+ glXQueryDrawable(gDpy, gPBuffer, GLX_PRESERVED_CONTENTS, &v);
printf("GLX_PRESERVED_CONTENTS = %u\n", v);
- glXQueryDrawable( gDpy, gPBuffer, GLX_LARGEST_PBUFFER, &v);
+ glXQueryDrawable(gDpy, gPBuffer, GLX_LARGEST_PBUFFER, &v);
printf("GLX_LARGEST_PBUFFER = %u\n", v);
- glXQueryDrawable( gDpy, gPBuffer, GLX_FBCONFIG_ID, &v);
+ glXQueryDrawable(gDpy, gPBuffer, GLX_FBCONFIG_ID, &v);
printf("GLX_FBCONFIG_ID = %u\n", v);
}
@@ -258,7 +258,7 @@ Setup(int width, int height)
return 0;
}
- return 1; /* Success!! */
+ return 1; /* Success!! */
}
@@ -276,12 +276,12 @@ InitGL(void)
glEnable(GL_CULL_FACE);
glViewport(0, 0, gWidth, gHeight);
- glMatrixMode( GL_PROJECTION );
+ glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
- glMatrixMode( GL_MODELVIEW );
+ glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
+ glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
+ glTranslatef(0.0, 0.0, -15.0);
}
@@ -311,8 +311,7 @@ static void
drawBox(GLfloat x0, GLfloat x1, GLfloat y0, GLfloat y1,
GLfloat z0, GLfloat z1, GLenum type)
{
- static GLfloat n[6][3] =
- {
+ static GLfloat n[6][3] = {
{-1.0, 0.0, 0.0},
{0.0, 1.0, 0.0},
{1.0, 0.0, 0.0},
@@ -320,8 +319,7 @@ drawBox(GLfloat x0, GLfloat x1, GLfloat y0, GLfloat y1,
{0.0, 0.0, 1.0},
{0.0, 0.0, -1.0}
};
- static GLint faces[6][4] =
- {
+ static GLint faces[6][4] = {
{0, 1, 2, 3},
{3, 2, 6, 7},
{7, 6, 5, 4},
@@ -377,10 +375,10 @@ Render(void)
glClearColor(0.2, 0.2, 0.9, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- for (i=0;i<NumBoxes;i++) {
+ for (i = 0; i < NumBoxes; i++) {
float tx = -2.0 + 4.0 * Random();
float ty = -2.0 + 4.0 * Random();
- float tz = 4.0 - 16.0 * Random();
+ float tz = 4.0 - 16.0 * Random();
float sx = 0.1 + Random() * 0.4;
float sy = 0.1 + Random() * 0.4;
float sz = 0.1 + Random() * 0.4;
@@ -423,22 +421,22 @@ WriteFile(const char *filename)
printf("Couldn't open image file: %s\n", filename);
return;
}
- fprintf(f,"P6\n");
- fprintf(f,"# ppm-file created by %s\n", "trdemo2");
- fprintf(f,"%i %i\n", gWidth, gHeight);
- fprintf(f,"255\n");
+ fprintf(f, "P6\n");
+ fprintf(f, "# ppm-file created by %s\n", "trdemo2");
+ fprintf(f, "%i %i\n", gWidth, gHeight);
+ fprintf(f, "255\n");
fclose(f);
- f = fopen(filename, "ab"); /* now append binary data */
+ f = fopen(filename, "ab"); /* now append binary data */
if (!f) {
printf("Couldn't append to image file: %s\n", filename);
return;
}
- for (i=0;i<gHeight;i++) {
+ for (i = 0; i < gHeight; i++) {
GLubyte *rowPtr;
/* Remember, OpenGL images are bottom to top. Have to reverse. */
- rowPtr = image + (gHeight-1-i) * gWidth*3;
- fwrite(rowPtr, 1, gWidth*3, f);
+ rowPtr = image + (gHeight - 1 - i) * gWidth * 3;
+ fwrite(rowPtr, 1, gWidth * 3, f);
}
fclose(f);
@@ -465,18 +463,18 @@ Usage(const char *appName)
int
main(int argc, char *argv[])
{
- if (argc!=4) {
+ if (argc != 4) {
Usage(argv[0]);
}
else {
int width = atoi(argv[1]);
int height = atoi(argv[2]);
char *fileName = argv[3];
- if (width<=0) {
+ if (width <= 0) {
printf("Error: width parameter must be at least 1.\n");
return 1;
}
- if (height<=0) {
+ if (height <= 0) {
printf("Error: height parameter must be at least 1.\n");
return 1;
}
diff --git a/src/xdemos/pbinfo.c b/src/xdemos/pbinfo.c
index 7725e3d7..73cdf075 100644
--- a/src/xdemos/pbinfo.c
+++ b/src/xdemos/pbinfo.c
@@ -69,22 +69,22 @@ main(int argc, char *argv[])
Bool horizFormat = True;
int i;
- for (i=1; i<argc; i++) {
- if (strcmp(argv[i],"-display")==0) {
- if (i+1<argc) {
- dpyName = argv[i+1];
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-display") == 0) {
+ if (i + 1 < argc) {
+ dpyName = argv[i + 1];
i++;
}
}
- else if (strcmp(argv[i],"-t")==0) {
+ else if (strcmp(argv[i], "-t") == 0) {
/* tabular format */
horizFormat = True;
}
- else if (strcmp(argv[i],"-v")==0) {
+ else if (strcmp(argv[i], "-v") == 0) {
/* verbose format */
horizFormat = False;
}
- else if (strcmp(argv[i],"-help")==0) {
+ else if (strcmp(argv[i], "-help") == 0) {
PrintUsage();
return 0;
}
diff --git a/src/xdemos/pbutil.c b/src/xdemos/pbutil.c
index 714b3ccf..a2fd2575 100644
--- a/src/xdemos/pbutil.c
+++ b/src/xdemos/pbutil.c
@@ -44,7 +44,7 @@ QueryFBConfig(Display *dpy, int screen)
{
char *extensions;
extensions = (char *) glXQueryServerString(dpy, screen, GLX_EXTENSIONS);
- if (extensions && strstr(extensions,"GLX_SGIX_fbconfig")) {
+ if (extensions && strstr(extensions, "GLX_SGIX_fbconfig")) {
return 2;
}
}
@@ -158,8 +158,7 @@ GetFBConfigAttrib(Display *dpy, int screen,
#elif defined(GLX_SGIX_fbconfig)
const GLXFBConfigSGIX config,
#endif
- int attrib
- )
+ int attrib)
{
int fbcSupport = QueryFBConfig(dpy, screen);
int value = 0;
@@ -204,7 +203,7 @@ void
PrintFBConfigInfo(Display *dpy, int screen, FBCONFIG config, Bool horizFormat)
{
PBUFFER pBuffer;
- int width=2, height=2;
+ int width = 2, height = 2;
int bufferSize, level, doubleBuffer, stereo, auxBuffers;
int redSize, greenSize, blueSize, alphaSize;
int depthSize, stencilSize;
@@ -259,13 +258,20 @@ PrintFBConfigInfo(Display *dpy, int screen, FBCONFIG config, Bool horizFormat)
if (horizFormat) {
printf("0x%-9x ", id);
- if (xVisual==GLX_STATIC_GRAY) printf("StaticGray ");
- else if (xVisual==GLX_GRAY_SCALE) printf("GrayScale ");
- else if (xVisual==GLX_STATIC_COLOR) printf("StaticColor ");
- else if (xVisual==GLX_PSEUDO_COLOR) printf("PseudoColor ");
- else if (xVisual==GLX_TRUE_COLOR) printf("TrueColor ");
- else if (xVisual==GLX_DIRECT_COLOR) printf("DirectColor ");
- else printf(" -none- ");
+ if (xVisual == GLX_STATIC_GRAY)
+ printf("StaticGray ");
+ else if (xVisual == GLX_GRAY_SCALE)
+ printf("GrayScale ");
+ else if (xVisual == GLX_STATIC_COLOR)
+ printf("StaticColor ");
+ else if (xVisual == GLX_PSEUDO_COLOR)
+ printf("PseudoColor ");
+ else if (xVisual == GLX_TRUE_COLOR)
+ printf("TrueColor ");
+ else if (xVisual == GLX_DIRECT_COLOR)
+ printf("DirectColor ");
+ else
+ printf(" -none- ");
printf(" %3d %3d %s %s %s %2s ", bufferSize, level,
(renderType & GLX_RGBA_BIT_SGIX) ? "y" : ".",
(renderType & GLX_COLOR_INDEX_BIT_SGIX) ? "y" : ".",
@@ -300,13 +306,18 @@ PrintFBConfigInfo(Display *dpy, int screen, FBCONFIG config, Bool horizFormat)
printf(" Sample Buffers: %d\n", sampleBuffers);
printf(" Samples/Pixel: %d\n", samples);
printf(" Drawable Types: ");
- if (drawableType & GLX_WINDOW_BIT) printf("Window ");
- if (drawableType & GLX_PIXMAP_BIT) printf("Pixmap ");
- if (drawableType & GLX_PBUFFER_BIT) printf("PBuffer");
+ if (drawableType & GLX_WINDOW_BIT)
+ printf("Window ");
+ if (drawableType & GLX_PIXMAP_BIT)
+ printf("Pixmap ");
+ if (drawableType & GLX_PBUFFER_BIT)
+ printf("PBuffer");
printf("\n");
printf(" Render Types: ");
- if (renderType & GLX_RGBA_BIT_SGIX) printf("RGBA ");
- if (renderType & GLX_COLOR_INDEX_BIT_SGIX) printf("CI ");
+ if (renderType & GLX_RGBA_BIT_SGIX)
+ printf("RGBA ");
+ if (renderType & GLX_COLOR_INDEX_BIT_SGIX)
+ printf("CI ");
printf("\n");
printf(" X Renderable: %s\n", xRenderable ? "yes" : "no");
diff --git a/src/xdemos/pbutil.h b/src/xdemos/pbutil.h
index 2258c2da..d0a51d0d 100644
--- a/src/xdemos/pbutil.h
+++ b/src/xdemos/pbutil.h
@@ -15,13 +15,13 @@
#if defined(GLX_VERSION_1_3)
-#define PBUFFER GLXPbuffer
+#define PBUFFER GLXPbuffer
#define FBCONFIG GLXFBConfig
#elif defined(GLX_SGIX_fbconfig) && defined(GLX_SGIX_pbuffer)
-#define PBUFFER GLXPbufferSGIX
+#define PBUFFER GLXPbufferSGIX
#define FBCONFIG GLXFBConfigSGIX
#else
-#define PBUFFER int
+#define PBUFFER int
#define FBCONFIG int
#endif
@@ -66,4 +66,4 @@ extern void
DestroyPbuffer(Display *dpy, int screen, PBUFFER pbuffer);
-#endif /*PBUTIL_H*/
+#endif /*PBUTIL_H*/
diff --git a/src/xdemos/shape.c b/src/xdemos/shape.c
index 8d0c7da9..f7464045 100644
--- a/src/xdemos/shape.c
+++ b/src/xdemos/shape.c
@@ -27,7 +27,7 @@
#include <GL/glx.h>
-static int Width=500, Height=500;
+static int Width = 500, Height = 500;
static float Xangle = 0.0, Yangle = 0.0;
static int Sides = 5;
@@ -41,7 +41,7 @@ current_time(void)
{
struct timeval tv;
#ifdef __VMS
- (void) gettimeofday(&tv, NULL );
+ (void) gettimeofday(&tv, NULL);
#else
struct timezone tz;
(void) gettimeofday(&tv, &tz);
@@ -72,16 +72,16 @@ display(Display *dpy, Window win)
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_LINE_LOOP);
glVertex3f(-1.0, -1.0, -1.0);
- glVertex3f( 1.0, -1.0, -1.0);
- glVertex3f( 1.0, 1.0, -1.0);
- glVertex3f(-1.0, 1.0, -1.0);
+ glVertex3f(1.0, -1.0, -1.0);
+ glVertex3f(1.0, 1.0, -1.0);
+ glVertex3f(-1.0, 1.0, -1.0);
glEnd();
glBegin(GL_LINE_LOOP);
glVertex3f(-1.0, -1.0, 1.0);
- glVertex3f( 1.0, -1.0, 1.0);
- glVertex3f( 1.0, 1.0, 1.0);
- glVertex3f(-1.0, 1.0, 1.0);
+ glVertex3f(1.0, -1.0, 1.0);
+ glVertex3f(1.0, 1.0, 1.0);
+ glVertex3f(-1.0, 1.0, 1.0);
glEnd();
glBegin(GL_LINES);
@@ -100,49 +100,49 @@ display(Display *dpy, Window win)
glColor3f(1, 0, 0);
glBegin(GL_POLYGON);
glVertex3f(1, -1, -1);
- glVertex3f(1, 1, -1);
- glVertex3f(1, 1, 1);
- glVertex3f(1, -1, 1);
+ glVertex3f(1, 1, -1);
+ glVertex3f(1, 1, 1);
+ glVertex3f(1, -1, 1);
glEnd();
glColor3f(0, 1, 1);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, -1);
- glVertex3f(-1, 1, -1);
- glVertex3f(-1, 1, 1);
- glVertex3f(-1, -1, 1);
+ glVertex3f(-1, 1, -1);
+ glVertex3f(-1, 1, 1);
+ glVertex3f(-1, -1, 1);
glEnd();
glColor3f(0, 1, 0);
glBegin(GL_POLYGON);
glVertex3f(-1, 1, -1);
- glVertex3f( 1, 1, -1);
- glVertex3f( 1, 1, 1);
- glVertex3f(-1, 1, 1);
+ glVertex3f(1, 1, -1);
+ glVertex3f(1, 1, 1);
+ glVertex3f(-1, 1, 1);
glEnd();
glColor3f(1, 0, 1);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, -1);
- glVertex3f( 1, -1, -1);
- glVertex3f( 1, -1, 1);
- glVertex3f(-1, -1, 1);
+ glVertex3f(1, -1, -1);
+ glVertex3f(1, -1, 1);
+ glVertex3f(-1, -1, 1);
glEnd();
glColor3f(0, 0, 1);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 1);
- glVertex3f( 1, -1, 1);
- glVertex3f( 1, 1, 1);
- glVertex3f(-1, 1, 1);
+ glVertex3f(1, -1, 1);
+ glVertex3f(1, 1, 1);
+ glVertex3f(-1, 1, 1);
glEnd();
glColor3f(1, 1, 0);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, -1);
- glVertex3f( 1, -1, -1);
- glVertex3f( 1, 1, -1);
- glVertex3f(-1, 1, -1);
+ glVertex3f(1, -1, -1);
+ glVertex3f(1, 1, -1);
+ glVertex3f(-1, 1, -1);
glEnd();
glPopMatrix();
@@ -183,7 +183,7 @@ make_shape_mask(Display *dpy, Window win, int width, int height, int sides)
float radius = width / 2;
int i;
XPoint points[100];
- for (i=0;i<sides;i++) {
+ for (i = 0; i < sides; i++) {
int x = cx + radius * sin(angle);
int y = cy - radius * cos(angle);
points[i].x = x;
@@ -272,7 +272,7 @@ event_loop(Display *dpy, Window win)
if (t0 < 0.0)
t0 = t;
dt = t - t0;
- Xangle += 90.0 * dt; /* 90 degrees per second */
+ Xangle += 90.0 * dt; /* 90 degrees per second */
Yangle += 70.0 * dt;
t0 = t;
display(dpy, win);
@@ -290,7 +290,7 @@ alloc_colormap(Display *dpy, Window parent, Visual *vis)
Screen *scr = DefaultScreenOfDisplay(dpy);
int scrnum = DefaultScreen(dpy);
- if (MaxCmapsOfScreen(scr)==1 && vis==DefaultVisual(dpy, scrnum)) {
+ if (MaxCmapsOfScreen(scr) == 1 && vis == DefaultVisual(dpy, scrnum)) {
/* The window and root are of the same visual type so */
/* share the root colormap. */
return DefaultColormap(dpy, scrnum);
@@ -329,7 +329,7 @@ main(int argc, char *argv[])
}
/* check that we can use the shape extension */
- if (!XQueryExtension(dpy, "SHAPE", &ignore, &ignore, &ignore )) {
+ if (!XQueryExtension(dpy, "SHAPE", &ignore, &ignore, &ignore)) {
fprintf(stderr, "Display doesn't support shape extension\n");
return 1;
}
diff --git a/src/xdemos/sharedtex.c b/src/xdemos/sharedtex.c
index 81cdc536..44c73e78 100644
--- a/src/xdemos/sharedtex.c
+++ b/src/xdemos/sharedtex.c
@@ -108,7 +108,7 @@ CreateWindow(const char *name)
XSizeHints sizehints;
sizehints.x = xpos;
sizehints.y = ypos;
- sizehints.width = WinWidth;
+ sizehints.width = WinWidth;
sizehints.height = WinHeight;
sizehints.flags = USSize | USPosition;
XSetNormalHints(Dpy, Win, &sizehints);
@@ -167,7 +167,7 @@ InitContext(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glEnable(GL_TEXTURE_2D);
- printf("GL_RENDERER = %s\n", (char*) glGetString(GL_RENDERER));
+ printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
}
@@ -290,7 +290,7 @@ EventLoop(void)
Redraw();
break;
default:
- /*no-op*/ ;
+ /*no-op*/;
}
}
@@ -309,7 +309,7 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0 && i < argc) {
- DisplayName = argv[i+1];
+ DisplayName = argv[i + 1];
i++;
}
}
diff --git a/src/xdemos/sharedtex_mt.c b/src/xdemos/sharedtex_mt.c
index 253edbf4..3ad8ca08 100644
--- a/src/xdemos/sharedtex_mt.c
+++ b/src/xdemos/sharedtex_mt.c
@@ -151,7 +151,7 @@ AddWindow(Display *dpy, const char *displayName, int xpos, int ypos,
XSizeHints sizehints;
sizehints.x = xpos;
sizehints.y = ypos;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
@@ -187,7 +187,7 @@ AddWindow(Display *dpy, const char *displayName, int xpos, int ypos,
h->visInfo = visinfo;
pthread_mutex_init(&h->drawMutex, NULL);
NumWindows++;
- return &Windows[NumWindows-1];
+ return &Windows[NumWindows - 1];
}
}
@@ -385,7 +385,7 @@ threadRunner(void *arg)
win = &Windows[tia->id];
- while(!terminate) {
+ while (!terminate) {
usleep(1000);
Redraw(win);
}
@@ -446,7 +446,7 @@ EventLoop(void)
terminate = 1;
return;
default:
- /*no-op*/ ;
+ /*no-op*/;
}
}
}
@@ -473,9 +473,9 @@ main(int argc, char *argv[])
return -1;
/* four windows and contexts sharing display lists and texture objects */
- h0 = AddWindow(gDpy, dpyName, 10, 10, gCtx);
- (void) AddWindow(gDpy, dpyName, 330, 10, gCtx);
- (void) AddWindow(gDpy, dpyName, 10, 350, gCtx);
+ h0 = AddWindow(gDpy, dpyName, 10, 10, gCtx);
+ (void) AddWindow(gDpy, dpyName, 330, 10, gCtx);
+ (void) AddWindow(gDpy, dpyName, 10, 350, gCtx);
(void) AddWindow(gDpy, dpyName, 330, 350, gCtx);
if (!glXMakeCurrent(gDpy, h0->Win, gCtx)) {
diff --git a/src/xdemos/texture_from_pixmap.c b/src/xdemos/texture_from_pixmap.c
index f9b1e15e..fbf80886 100644
--- a/src/xdemos/texture_from_pixmap.c
+++ b/src/xdemos/texture_from_pixmap.c
@@ -233,7 +233,7 @@ CreateWindow(Display *dpy, XVisualInfo *visinfo,
visinfo->visual, mask, &attr);
if (win) {
XSizeHints sizehints;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize;
XSetNormalHints(dpy, win, &sizehints);
@@ -291,7 +291,7 @@ Redraw(Display *dpy, Window win, float rot)
glTexCoord2d(0.0, bottom);
glVertex2f(-1, -1);
glTexCoord2d(1.0, bottom);
- glVertex2f( 1, -1);
+ glVertex2f(1, -1);
glTexCoord2d(1.0, top);
glVertex2d(1.0, 1.0);
glTexCoord2d(0.0, top);
diff --git a/src/xdemos/wincopy.c b/src/xdemos/wincopy.c
index 20bbbe55..1dea7b89 100644
--- a/src/xdemos/wincopy.c
+++ b/src/xdemos/wincopy.c
@@ -49,7 +49,7 @@
static Display *Dpy;
static int ScrNum;
static GLXContext Context;
-static Window Win[2]; /* Win[0] = source, Win[1] = dest */
+static Window Win[2]; /* Win[0] = source, Win[1] = dest */
static GLint Width[2], Height[2];
static GLboolean TestClipping = GL_FALSE;
static GLfloat Angle = 0.0;
@@ -84,7 +84,7 @@ CreateWindow(Display *dpy, int scrnum, XVisualInfo *visinfo,
XSizeHints sizehints;
sizehints.x = xpos;
sizehints.y = ypos;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
@@ -101,7 +101,7 @@ static void
Redraw(void)
{
/* make the first window the current one */
- if (! (*make_context_current)(Dpy, Win[0], Win[0], Context)) {
+ if (!(*make_context_current)(Dpy, Win[0], Win[0], Context)) {
printf("glXMakeContextCurrent failed in Redraw()\n");
return;
}
@@ -133,8 +133,8 @@ Redraw(void)
glRotatef(Angle, 0, 0, 1);
glBegin(GL_POLYGON);
glVertex2f(-0.5, -0.25);
- glVertex2f( 0.5, -0.25);
- glVertex2f( 0.5, 0.25);
+ glVertex2f(0.5, -0.25);
+ glVertex2f(0.5, 0.25);
glVertex2f(-0.5, 0.25);
glEnd();
glPopMatrix();
@@ -198,7 +198,7 @@ EventLoop(void)
XEvent event;
while (1) {
if (XPending(Dpy) > 0) {
- XNextEvent( Dpy, &event );
+ XNextEvent(Dpy, &event);
switch (event.type) {
case Expose:
Redraw();
@@ -224,7 +224,7 @@ EventLoop(void)
}
break;
default:
- /*no-op*/ ;
+ /*no-op*/;
}
}
else {
@@ -259,17 +259,17 @@ Init(void)
if (major * 100 + minor >= 103) {
make_context_current = (PFNGLXMAKECURRENTREADSGIPROC)
- glXGetProcAddressARB( (GLubyte *) "glXMakeContextCurrent" );
+ glXGetProcAddressARB((GLubyte *) "glXMakeContextCurrent");
}
else {
- const char * const glxExtensions = glXQueryExtensionsString(Dpy, ScrNum);
- const char * ext = strstr( glxExtensions, "GLX_SGI_make_current_read" );
- const size_t len = strlen( "GLX_SGI_make_current_read" );
+ const char *const glxExtensions = glXQueryExtensionsString(Dpy, ScrNum);
+ const char *ext = strstr(glxExtensions, "GLX_SGI_make_current_read");
+ const size_t len = strlen("GLX_SGI_make_current_read");
- if ( (ext != NULL)
- && ((ext[len] == ' ') || (ext[len] == '\0')) ) {
+ if ((ext != NULL)
+ && ((ext[len] == ' ') || (ext[len] == '\0'))) {
make_context_current = (PFNGLXMAKECURRENTREADSGIPROC)
- glXGetProcAddressARB( (GLubyte *) "glXMakeCurrentReadSGI" );
+ glXGetProcAddressARB((GLubyte *) "glXMakeCurrentReadSGI");
}
}
diff --git a/src/xdemos/xfont.c b/src/xdemos/xfont.c
index 68490ceb..98809d38 100644
--- a/src/xdemos/xfont.c
+++ b/src/xdemos/xfont.c
@@ -50,23 +50,23 @@ redraw(Display *dpy, Window w)
{
static const char *text = "This is glXUseXFont()";
- glClear( GL_COLOR_BUFFER_BIT );
+ glClear(GL_COLOR_BUFFER_BIT);
/* triangle */
- glColor3f( 0.2, 0.2, 1.0 );
+ glColor3f(0.2, 0.2, 1.0);
glBegin(GL_TRIANGLES);
- glVertex2f( 0, 0.8 );
- glVertex2f( -0.8, -0.7 );
- glVertex2f( 0.8, -0.7 );
+ glVertex2f(0, 0.8);
+ glVertex2f(-0.8, -0.7);
+ glVertex2f(0.8, -0.7);
glEnd();
/* text */
- glColor3f( 1, 1, 1 );
+ glColor3f(1, 1, 1);
glRasterPos2f(-0.8, 0);
glListBase(FontBase);
glCallLists(strlen(text), GL_UNSIGNED_BYTE, (GLubyte *) text);
- glXSwapBuffers( dpy, w );
+ glXSwapBuffers(dpy, w);
}
@@ -74,10 +74,10 @@ redraw(Display *dpy, Window w)
static void
resize(unsigned int width, unsigned int height)
{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
+ glViewport(0, 0, width, height);
+ glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
+ glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
}
@@ -125,10 +125,10 @@ make_rgb_db_window(Display *dpy, int xpos, int ypos, unsigned int width,
GLXContext ctx;
XVisualInfo *visinfo;
- scrnum = DefaultScreen( dpy );
- root = RootWindow( dpy, scrnum );
+ scrnum = DefaultScreen(dpy);
+ root = RootWindow(dpy, scrnum);
- visinfo = glXChooseVisual( dpy, scrnum, attrib );
+ visinfo = glXChooseVisual(dpy, scrnum, attrib);
if (!visinfo) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
@@ -137,30 +137,29 @@ make_rgb_db_window(Display *dpy, int xpos, int ypos, unsigned int width,
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
- win = XCreateWindow( dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
+ win = XCreateWindow(dpy, root, 0, 0, width, height, 0, visinfo->depth,
+ InputOutput, visinfo->visual, mask, &attr);
{
XSizeHints sizehints;
sizehints.x = xpos;
sizehints.y = ypos;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
- XSetStandardProperties(dpy, win, ProgramName, ProgramName,
- None, (char **)NULL, 0, &sizehints);
+ XSetStandardProperties(dpy, win, ProgramName, ProgramName, None,
+ (char **) NULL, 0, &sizehints);
}
- ctx = glXCreateContext( dpy, visinfo, NULL, True );
+ ctx = glXCreateContext(dpy, visinfo, NULL, True);
- glXMakeCurrent( dpy, win, ctx );
+ glXMakeCurrent(dpy, win, ctx);
return win;
}
@@ -172,19 +171,18 @@ event_loop(Display *dpy)
XEvent event;
while (1) {
- XNextEvent( dpy, &event );
+ XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
- redraw( dpy, event.xany.window );
+ redraw(dpy, event.xany.window);
break;
case ConfigureNotify:
- resize( event.xconfigure.width, event.xconfigure.height );
+ resize(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
exit(0);
- default:
- ; /* no-op */
+ default:; /* no-op */
}
}
}
@@ -198,14 +196,14 @@ main(int argc, char *argv[])
dpy = XOpenDisplay(NULL);
- win = make_rgb_db_window( dpy, 0, 0, 300, 300 );
- setup_font( dpy );
+ win = make_rgb_db_window(dpy, 0, 0, 300, 300);
+ setup_font(dpy);
- glShadeModel( GL_FLAT );
- glClearColor( 0.5, 0.5, 1.0, 1.0 );
+ glShadeModel(GL_FLAT);
+ glClearColor(0.5, 0.5, 1.0, 1.0);
- XMapWindow( dpy, win );
+ XMapWindow(dpy, win);
- event_loop( dpy );
+ event_loop(dpy);
return 0;
}
diff --git a/src/xdemos/xrotfontdemo.c b/src/xdemos/xrotfontdemo.c
index 6c8f3f93..29cce088 100644
--- a/src/xdemos/xrotfontdemo.c
+++ b/src/xdemos/xrotfontdemo.c
@@ -50,24 +50,24 @@ redraw(Display *dpy, Window w)
static const char *text = " Rotated bitmap text";
int i;
- glClear( GL_COLOR_BUFFER_BIT );
+ glClear(GL_COLOR_BUFFER_BIT);
/* triangle */
- glColor3f( 0.2, 0.2, 1.0 );
+ glColor3f(0.2, 0.2, 1.0);
glBegin(GL_TRIANGLES);
- glVertex2f( -0.8, 0.7 );
- glVertex2f( -0.8, -0.7 );
- glVertex2f( 0.8, 0.0 );
+ glVertex2f(-0.8, 0.7);
+ glVertex2f(-0.8, -0.7);
+ glVertex2f(0.8, 0.0);
glEnd();
/* marker */
- glColor3f( 0, 1, 0 );
+ glColor3f(0, 1, 0);
glBegin(GL_POINTS);
glVertex2f(0, 0);
glEnd();
/* text */
- glColor3f( 1, 1, 1 );
+ glColor3f(1, 1, 1);
for (i = 0; i < 4; i++) {
glRasterPos2f(0, 0);
@@ -75,17 +75,17 @@ redraw(Display *dpy, Window w)
glCallLists(strlen(text), GL_UNSIGNED_BYTE, (GLubyte *) text);
}
- glXSwapBuffers( dpy, w );
+ glXSwapBuffers(dpy, w);
}
static void
resize(unsigned int width, unsigned int height)
{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
+ glViewport(0, 0, width, height);
+ glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
+ glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
}
@@ -137,10 +137,10 @@ make_rgb_db_window(Display *dpy, int xpos, int ypos, unsigned int width,
GLXContext ctx;
XVisualInfo *visinfo;
- scrnum = DefaultScreen( dpy );
- root = RootWindow( dpy, scrnum );
+ scrnum = DefaultScreen(dpy);
+ root = RootWindow(dpy, scrnum);
- visinfo = glXChooseVisual( dpy, scrnum, attrib );
+ visinfo = glXChooseVisual(dpy, scrnum, attrib);
if (!visinfo) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
@@ -149,19 +149,19 @@ make_rgb_db_window(Display *dpy, int xpos, int ypos, unsigned int width,
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
- win = XCreateWindow( dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
+ win = XCreateWindow(dpy, root, 0, 0, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr);
{
XSizeHints sizehints;
sizehints.x = xpos;
sizehints.y = ypos;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
@@ -170,9 +170,9 @@ make_rgb_db_window(Display *dpy, int xpos, int ypos, unsigned int width,
}
- ctx = glXCreateContext( dpy, visinfo, NULL, True );
+ ctx = glXCreateContext(dpy, visinfo, NULL, True);
- glXMakeCurrent( dpy, win, ctx );
+ glXMakeCurrent(dpy, win, ctx);
return win;
}
@@ -184,19 +184,18 @@ event_loop(Display *dpy)
XEvent event;
while (1) {
- XNextEvent( dpy, &event );
+ XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
- redraw( dpy, event.xany.window );
+ redraw(dpy, event.xany.window);
break;
case ConfigureNotify:
- resize( event.xconfigure.width, event.xconfigure.height );
+ resize(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
exit(0);
- default:
- ; /* no-op */
+ default:; /* no-op */
}
}
}
@@ -211,14 +210,14 @@ main(int argc, char *argv[])
dpy = XOpenDisplay(NULL);
- win = make_rgb_db_window( dpy, 0, 0, 300, 300 );
- setup_font( dpy );
+ win = make_rgb_db_window(dpy, 0, 0, 300, 300);
+ setup_font(dpy);
- glShadeModel( GL_FLAT );
- glClearColor( 0.5, 0.5, 1.0, 1.0 );
+ glShadeModel(GL_FLAT);
+ glClearColor(0.5, 0.5, 1.0, 1.0);
- XMapWindow( dpy, win );
+ XMapWindow(dpy, win);
- event_loop( dpy );
+ event_loop(dpy);
return 0;
}
diff --git a/src/xdemos/xuserotfont.c b/src/xdemos/xuserotfont.c
index 5600b122..398d3c72 100644
--- a/src/xdemos/xuserotfont.c
+++ b/src/xdemos/xuserotfont.c
@@ -127,7 +127,7 @@ fill_bitmap(Display *dpy, Pixmap pixmap, GC gc,
* corresponding XCharStruct.
*/
static const XCharStruct *
-isvalid(const XFontStruct * fs, unsigned int which)
+isvalid(const XFontStruct *fs, unsigned int which)
{
unsigned int rows, pages;
unsigned int byte1 = 0, byte2 = 0;
diff --git a/src/xdemos/yuvrect_client.c b/src/xdemos/yuvrect_client.c
index 607da60c..ae7002ac 100644
--- a/src/xdemos/yuvrect_client.c
+++ b/src/xdemos/yuvrect_client.c
@@ -14,7 +14,7 @@
#define GL_GLEXT_PROTOTYPES
#include <GL/glx.h>
-#include "../util/readtex.c" /* I know, this is a hack. */
+#include "../util/readtex.c" /* I know, this is a hack. */
#define TEXTURE_FILE DEMOS_DATA_DIR "girl2.rgb"
@@ -47,13 +47,13 @@ DrawObject(void)
static void
scr_Display(void)
{
- glClear( GL_COLOR_BUFFER_BIT );
+ glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
- glRotatef(Xrot, 1.0, 0.0, 0.0);
- glRotatef(Yrot, 0.0, 1.0, 0.0);
- glRotatef(Zrot, 0.0, 0.0, 1.0);
- DrawObject();
+ glRotatef(Xrot, 1.0, 0.0, 0.0);
+ glRotatef(Yrot, 0.0, 1.0, 0.0);
+ glRotatef(Zrot, 0.0, 0.0, 1.0);
+ DrawObject();
glPopMatrix();
}
@@ -62,13 +62,13 @@ scr_Display(void)
static void
Reshape(int width, int height)
{
- glViewport( 0, 0, width, height );
- glMatrixMode( GL_PROJECTION );
+ glViewport(0, 0, width, height);
+ glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 );
- glMatrixMode( GL_MODELVIEW );
+ glFrustum(-1.0, 1.0, -1.0, 1.0, 10.0, 100.0);
+ glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- glTranslatef( 0.0, 0.0, -15.0 );
+ glTranslatef(0.0, 0.0, -15.0);
}
static int
@@ -78,7 +78,7 @@ queryClient(Display *dpy, int screen)
char *extensions;
extensions = (char *)glXQueryExtensionsString(dpy, screen);
- if (!extensions || !strstr(extensions,"GLX_MESA_allocate_memory")) {
+ if (!extensions || !strstr(extensions, "GLX_MESA_allocate_memory")) {
return 0;
}
@@ -146,11 +146,10 @@ Init(int argc, char *argv[], Display *dpy, int screen, Window win)
}
#ifdef GLX_MESA_allocate_memory
- glx_memory = glXAllocateMemoryMESA(dpy, screen, ImgWidth * ImgHeight * 2, 0, 0 ,0);
+ glx_memory = glXAllocateMemoryMESA(dpy, screen, ImgWidth * ImgHeight * 2, 0, 0,0);
#endif
- if (!glx_memory)
- {
- fprintf(stderr,"Failed to allocate MESA memory\n");
+ if (!glx_memory) {
+ fprintf(stderr, "Failed to allocate MESA memory\n");
exit(-1);
}
@@ -196,10 +195,10 @@ make_window(Display *dpy, const char *name, int x, int y, int width, int height,
GLXContext ctx;
XVisualInfo *visinfo;
- scrnum = DefaultScreen( dpy );
- root = RootWindow( dpy, scrnum );
+ scrnum = DefaultScreen(dpy);
+ root = RootWindow(dpy, scrnum);
- visinfo = glXChooseVisual( dpy, scrnum, attribs );
+ visinfo = glXChooseVisual(dpy, scrnum, attribs);
if (!visinfo) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
@@ -208,21 +207,21 @@ make_window(Display *dpy, const char *name, int x, int y, int width, int height,
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
- attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
attr.override_redirect = 0;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
- win = XCreateWindow( dpy, root, 0, 0, width, height,
- 0, visinfo->depth, InputOutput,
- visinfo->visual, mask, &attr );
+ win = XCreateWindow(dpy, root, 0, 0, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr);
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
- sizehints.width = width;
+ sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(dpy, win, &sizehints);
@@ -230,7 +229,7 @@ make_window(Display *dpy, const char *name, int x, int y, int width, int height,
None, (char **)NULL, 0, &sizehints);
}
- ctx = glXCreateContext( dpy, visinfo, NULL, True );
+ ctx = glXCreateContext(dpy, visinfo, NULL, True);
if (!ctx) {
printf("Error: glXCreateContext failed\n");
exit(1);
@@ -287,7 +286,7 @@ main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
- dpyName = argv[i+1];
+ dpyName = argv[i + 1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {