home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / stereo / GL_5.2 / CheckExtension.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.0 KB  |  69 lines

  1. /*
  2.  * Copyright (C) 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. #include <stdio.h>
  18. #include <X11/Xlib.h>
  19. #include "SGIStereo.h"
  20.  
  21. void main()
  22. {
  23.     Display *dpy;
  24.     Bool extensionExists;
  25.     int major, minor, xsgiEvent, xsgiError, curmode;
  26.     Status stat;
  27.  
  28.     dpy = XOpenDisplay(NULL);
  29.         if(!dpy) 
  30.         {
  31.             printf("Unable to open X display\n");
  32.             exit(1);
  33.         }
  34.  
  35.     extensionExists = XSGIStereoQueryExtension(dpy, &xsgiEvent, &xsgiError);
  36.  
  37.     if (extensionExists)
  38.         {
  39.             printf("SoftStereo extension found\n");
  40.         stat = XSGIStereoQueryVersion(dpy, &major, &minor);
  41.         if (stat)
  42.             printf("\tVersion = %d.%d\n",major, minor);
  43.         else
  44.             printf("\tError querying version\n");
  45.     }else{
  46.             printf("SoftStereo extension not found\n");
  47.         printf("\txsgiEvent = %d\n",xsgiEvent);
  48.         printf("\txsgiError = %d\n",xsgiError);
  49.         }
  50.  
  51.     curmode = XSGIQueryStereoMode(dpy, RootWindow(dpy, DefaultScreen(dpy)));
  52.  
  53.     switch (curmode)
  54.     {
  55.         case X_STEREO_UNSUPPORTED:
  56.         printf("\tThis platform does not support X stereo\n");
  57.         break;
  58.         case STEREO_OFF:
  59.         printf("\tNot in stereo mode\n");
  60.         break;
  61.         case STEREO_BOTTOM:
  62.         printf("\tStereo, bottom half of screen is primary buffer\n");
  63.           break;
  64.         case STEREO_TOP:
  65.         printf("\tStereo, top half of screen is primary buffer\n");
  66.         break;
  67.     }
  68. }
  69.