home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
-
-
- #include <aux.h>
- #include <auxPrivate.h>
-
-
- /**************************************************************************
- * auxXErrorHandler() - X error handler routine
- **************************************************************************/
-
- int
- auxXErrorHandler( Display *display, XErrorEvent *event )
- {
- const int bufSize = 80;
- char buf[bufSize];
-
- printf( "\n Received X error ...\n" );
- printf( "\terror_code : %d\n", event->error_code );
- printf( "\trequest_code : %d\n", event->request_code );
- printf( "\tminor_code : %d\n\n", event->minor_code );
- XGetErrorText( display, event->error_code, buf, bufSize );
- printf( "\tError text : '%s'\n\n", buf );
- }
-
-
- /**************************************************************************
- * auxPrintVisualInfo() - Retrieve information from X visual
- **************************************************************************/
-
- static const char*
- className( int class )
- {
- static char *classes[] = {
- "StaticGray",
- "GrayScale",
- "StaticColor",
- "PseudoColor",
- "TrueColor",
- "DirectColor",
- };
-
- if ( class < ZERO || class > FIVE )
- return "unknown";
- else
- return classes[class];
- }
-
- GLvoid
- auxPrintVisualInfo( XVisualInfo *glxVisual )
- {
- int tmp;
-
- printf(" X Visual Information ...\n\n" );
- printf("\tvisualid : 0x%x\n", glxVisual->visualid );
- printf("\tclass : %s\n\n", className( glxVisual->class ) );
-
- #define TrueFalse(x) ( x ? "True" : "False" )
-
- glXGetConfig(auxState.display, glxVisual, GLX_USE_GL, &tmp);
- printf( "\tSupport GL ( GLX_USE_GL ) : %s\n", TrueFalse(tmp) );
-
- glXGetConfig(auxState.display, glxVisual, GLX_LEVEL, &tmp);
- printf( "\tFramebuffer ( GLX_LEVEL ) : %s\n\n",
- tmp < ZERO ? "Underlay" : tmp > ZERO ? "Overlay" : "Normal" );
-
- glXGetConfig(auxState.display, glxVisual, GLX_BUFFER_SIZE, &tmp);
- printf( "\tFramebuffer depth ( GLX_BUFFER_SIZE ) : %d\n", tmp );
-
- glXGetConfig(auxState.display, glxVisual, GLX_DOUBLEBUFFER, &tmp);
- printf( "\tDoublebuffer ( GLX_DOUBLEBUFFER ) : %s\n",
- TrueFalse(tmp) );
-
- glXGetConfig(auxState.display, glxVisual, GLX_DEPTH_SIZE, &tmp);
- printf( "\tDepth buffer depth ( GLX_DEPTH_SIZE ) : %d\n", tmp );
-
- glXGetConfig(auxState.display, glxVisual, GLX_STENCIL_SIZE, &tmp);
- printf( "\tStencil buffer depth ( GLX_STENCIL_SIZE ) : %d\n", tmp );
-
- glXGetConfig(auxState.display, glxVisual, GLX_STEREO, &tmp);
- printf( "\tStereo Buffer ( GLX_STEREO ) : %s\n",
- TrueFalse(tmp) );
-
- glXGetConfig(auxState.display, glxVisual, GLX_AUX_BUFFERS, &tmp);
- printf( "\tAuxillary Buffers ( GLX_AUX_BUFFERS ) : %d\n\n", tmp );
-
- glXGetConfig(auxState.display, glxVisual, GLX_RGBA, &tmp);
- printf( "\tColor mode ( GLX_RGBA ) : %s\n", tmp ? "RGBA" : "Index" );
-
- glXGetConfig(auxState.display, glxVisual, GLX_RED_SIZE, &tmp);
- printf( "\tRed Bits ( GLX_RED_SIZE ) : %d\n", tmp );
-
- glXGetConfig(auxState.display, glxVisual, GLX_GREEN_SIZE, &tmp);
- printf( "\tGreen Bits ( GLX_GREEN_SIZE ) : %d\n", tmp );
-
- glXGetConfig(auxState.display, glxVisual, GLX_BLUE_SIZE, &tmp);
- printf( "\tBlue Bits ( GLX_BLUE_SIZE ) : %d\n", tmp );
-
- glXGetConfig(auxState.display, glxVisual, GLX_ALPHA_SIZE, &tmp);
- printf( "\tAlpha Bits ( GLX_ALPHA_SIZE ) : %d\n\n", tmp );
-
- glXGetConfig(auxState.display, glxVisual, GLX_ACCUM_RED_SIZE, &tmp);
- printf( "\tRed Accumulation Bits ( GLX_ACCUM_RED_SIZE ) : %d\n", tmp );
-
- glXGetConfig(auxState.display, glxVisual, GLX_ACCUM_GREEN_SIZE, &tmp);
- printf( "\tGreen Accumulation Bits ( GLX_ACCUM_GREEN_SIZE ) : %d\n", tmp );
-
- glXGetConfig(auxState.display, glxVisual, GLX_ACCUM_BLUE_SIZE, &tmp);
- printf( "\tBlue Accumulation Bits ( GLX_ACCUM_BLUE_SIZE ) : %d\n", tmp );
-
- glXGetConfig(auxState.display, glxVisual, GLX_ACCUM_ALPHA_SIZE, &tmp);
- printf( "\tAlpha Accumulation Bits ( GLX_ACCUM_ALPHA_SIZE ) : %d\n\n", tmp );
- }
-
-
- /**************************************************************************
- * auxPrintAttributeList() - print out attribList
- **************************************************************************/
-
- GLvoid
- auxPrintAttributeList( int *list )
- {
- GLint i;
-
- static char *glxTokenName[] = {
- "None",
- "GLX_USE_GL",
- "GLX_BUFFER_SIZE",
- "GLX_LEVEL",
- "GLX_RGBA",
- "GLX_DOUBLEBUFFER",
- "GLX_STEREO",
- "GLX_AUX_BUFFERS",
- "GLX_RED_SIZE",
- "GLX_GREEN_SIZE",
- "GLX_BLUE_SIZE",
- "GLX_ALPHA_SIZE",
- "GLX_DEPTH_SIZE",
- "GLX_STENCIL_SIZE",
- "GLX_ACCUM_RED_SIZE",
- "GLX_ACCUM_GREEN_SIZE",
- "GLX_ACCUM_BLUE_SIZE",
- "GLX_ACCUM_ALPHA_SIZE"
- };
-
- printf( "\n Requested Attributes :\n" );
-
- for ( i = 0; list[i] != None; i++ )
- switch( list[i] ) {
-
- case GLX_USE_GL :
- case GLX_RGBA :
- case GLX_STEREO :
- case GLX_DOUBLEBUFFER :
- printf( "\t%s,\n", glxTokenName[list[i]] );
- break;
-
- case GLX_BUFFER_SIZE :
- case GLX_LEVEL :
- case GLX_AUX_BUFFERS :
- case GLX_RED_SIZE :
- case GLX_GREEN_SIZE :
- case GLX_BLUE_SIZE :
- case GLX_ALPHA_SIZE :
- case GLX_DEPTH_SIZE :
- case GLX_STENCIL_SIZE :
- case GLX_ACCUM_RED_SIZE :
- case GLX_ACCUM_GREEN_SIZE :
- case GLX_ACCUM_BLUE_SIZE :
- case GLX_ACCUM_ALPHA_SIZE :
- printf( "\t%s = %d,\n", glxTokenName[list[i]], list[i+1] );
- i++;
- break;
- }
- printf( "\tNone\n\n" );
- }
-