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 / stereo.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  3.7 KB  |  121 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. /* stereo.h */
  18.  
  19. #ifndef STEREO_H
  20. #define STEREO_H
  21.  
  22. #include <gl/get.h>
  23.  
  24. #ifndef STR_BOT
  25. #define STR_BOT                 27      /* Stereo, bottom buffer primary */
  26. #endif
  27.  
  28. #ifndef STR_TOP
  29. #define STR_TOP                 28      /* Stereo, top buffer primary */
  30. #endif
  31.  
  32. #ifdef USE_X
  33. #include <gl/glws.h>
  34. #include <X11/Xlib.h>
  35. #include <X11/Xutil.h>
  36. #else
  37. #include <gl/gl.h>
  38. #include <gl/device.h>
  39. #endif
  40.  
  41. /*
  42.  * These two variables define the height of each stereo field that is
  43.  * displayed, and the offset (from the bottom of the screen) of the
  44.  * top one, both in pixels.
  45.  *
  46.  * They are initialized in stereo_on; this is done this way in
  47.  * anticipation of a future getgdesc()-like call to return their
  48.  * values, to avoid having to re-code all of the stereo demos as soon
  49.  * as differing, incompatible stereo hardware comes out.
  50.  */
  51. extern int YMAXSTEREO;
  52. extern int YOFFSET;
  53.  
  54. /* void stereopersp(fovy, aspect, near, far, conv, eye)
  55.  *
  56.  * fovy, aspect, near, far - work just like the 'perspective' command
  57.  *
  58.  * conv - the plane at which the left and right image will converge on the 
  59.  *      screen.  If conv is equal to the near plane, the stereo image will
  60.  *      appear to be behind the plane of the screen.  If conv is set to 
  61.  *      the far plane, the stereo image will appear in front of the screen.
  62.  *
  63.  * eye - the distance (in world coordinates) the eye is off-center (half the
  64.  *     eye separation).
  65.  *
  66.  * For this to work, you must link with the graphics library (-lgl_s)
  67.  * and the math library (-lm).
  68.  */
  69. extern void stereopersp(int, float, float, float, float, float);
  70.  
  71. /*
  72.  * stereo_on()
  73.  *
  74.  * If the hardware supports it and it hasn't been done before, this
  75.  * routine will:
  76.  *  Switch the monitor into 120 HZ mode
  77.  *  Constrain the mouse to the lower half of the screen
  78.  * It also sets the YMAXSTEREO and YOFFSET variables
  79.  */
  80. extern void stereo_on(int);
  81.  
  82. /*
  83.  * stereo_off()
  84.  *
  85.  * Undoes the effects of stereo_on().  If multiple windowed stereo
  86.  * applications are running, the application that turned on stereo
  87.  * will turn it off.  A background program should probably be run
  88.  * first thing, to provide a suitable backdrop for the other windows
  89.  * (not a concern if the application takes over the entire screen, of
  90.  * course).
  91.  */
  92. extern void stereo_off();
  93.  
  94. /*
  95.  * Some routines to give a little bit of support to multi-windowed
  96.  * stereo applications.
  97.  *
  98.  * This was hacked together very quickly; stereo windows may easily be
  99.  * confused by pushing or popping them, or by stowing them.  Don't do
  100.  * that.
  101.  */
  102. /*
  103.  * long st_winopen(char *title)
  104.  *   Returns a unique identifier for a pair of stereo windows.  This
  105.  *   routine will also call stereo_on for you, if necessary.
  106.  * void st_winclose(long)
  107.  */
  108. extern long st_winopen(char *title, int ival, int *softStereo);
  109. extern void st_winclose(long lval);
  110.  
  111. /*
  112.  * void st_right(long st_id)
  113.  * void st_left(long st_id)
  114.  *   Before drawing into the left or right eye view, call one of these
  115.  *   routines.
  116.  */
  117. extern void st_right(long st_id);
  118. extern void st_left(long st_id);
  119.  
  120. #endif
  121.