home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / newopg.zip / TK.H < prev    next >
Text File  |  1995-03-04  |  8KB  |  278 lines

  1. /* @(#)18    1.2  R2/OPENGL/test/tk2/tk.h, gltest, r5gos325, 9411A325a 3/7/94 14:21:09 */
  2. /*
  3.  *   COMPONENT_NAME: GLTEST
  4.  *
  5.  *   FUNCTIONS: TK_HAS_ACCUM
  6.  *        TK_HAS_ALPHA
  7.  *        TK_HAS_DEPTH
  8.  *        TK_HAS_STENCIL
  9.  *        TK_IS_DIRECT
  10.  *        TK_IS_DOUBLE
  11.  *        TK_IS_INDEX
  12.  *        TK_IS_INDIRECT
  13.  *        TK_IS_RGB
  14.  *        TK_IS_SINGLE
  15.  *        TK_SETCOLOR
  16.  *        tkDisplayFunc
  17.  *        tkExposeFunc
  18.  *        tkIdleFunc
  19.  *        tkKeyDownFunc
  20.  *        tkMouseDownFunc
  21.  *        tkMouseMoveFunc
  22.  *        tkMouseUpFunc
  23.  *        tkReshapeFunc
  24.  *        
  25.  *
  26.  *   ORIGINS: 21,27
  27.  *
  28.  *
  29.  *   (C) COPYRIGHT International Business Machines Corp. 1993
  30.  *   All Rights Reserved
  31.  *   Licensed Materials - Property of IBM
  32.  *   US Government Users Restricted Rights - Use, duplication or
  33.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  34.  */
  35.  
  36. /*
  37.  * (c) Copyright 1993, Silicon Graphics, Inc.
  38.  * ALL RIGHTS RESERVED 
  39.  * Permission to use, copy, modify, and distribute this software for 
  40.  * any purpose and without fee is hereby granted, provided that the above
  41.  * copyright notice appear in all copies and that both the copyright notice
  42.  * and this permission notice appear in supporting documentation, and that 
  43.  * the name of Silicon Graphics, Inc. not be used in advertising
  44.  * or publicity pertaining to distribution of the software without specific,
  45.  * written prior permission. 
  46.  *
  47.  * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
  48.  * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
  49.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
  50.  * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
  51.  * GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
  52.  * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
  53.  * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
  54.  * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
  55.  * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN
  56.  * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
  57.  * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
  58.  * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
  59.  * 
  60.  * US Government Users Restricted Rights 
  61.  * Use, duplication, or disclosure by the Government is subject to
  62.  * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
  63.  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
  64.  * clause at DFARS 252.227-7013 and/or in similar or successor
  65.  * clauses in the FAR or the DOD or NASA FAR Supplement.
  66.  * Unpublished-- rights reserved under the copyright laws of the
  67.  * United States.  Contractor/manufacturer is Silicon Graphics,
  68.  * Inc., 2011 N.  Shoreline Blvd., Mountain View, CA 94039-7311.
  69.  *
  70.  * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
  71.  */
  72. #include <pgl.h>
  73. #include <gl.h>
  74. #include <glu.h>
  75.  
  76.  
  77. /*
  78. ** Window Types
  79. */
  80.  
  81.  
  82. // following are different between aux and pm....
  83. #define AUX_ESCAPE              0x1B
  84. #define PM_ESCAPE               0x0F
  85.  
  86. #define AUX_LEFT                0x25
  87. #define PM_LEFT                 0x15
  88.  
  89. #define AUX_UP                  0x26
  90. #define PM_UP                   0x16
  91.  
  92. #define AUX_RIGHT               0x27
  93. #define PM_RIGHT                0x17
  94.  
  95. #define AUX_DOWN                0x28
  96. #define PM_DOWN                 0x18
  97.  
  98.  
  99. #define TK_RGB        0
  100. #define TK_INDEX    1
  101. #define TK_SINGLE    0
  102. #define TK_DOUBLE    2
  103. #define TK_DIRECT    0
  104. #define TK_INDIRECT    4
  105. #define TK_ACCUM    8
  106. #define TK_ALPHA    16
  107. #define TK_DEPTH    32
  108. #define TK_STENCIL    64
  109.  
  110. /* 
  111. ** Window Masks
  112. */
  113.  
  114. #define TK_IS_RGB(x)        (((x) & TK_INDEX) == 0)
  115. #define TK_IS_INDEX(x)        (((x) & TK_INDEX) != 0)
  116. #define TK_IS_SINGLE(x)        (((x) & TK_DOUBLE) == 0)
  117. #define TK_IS_DOUBLE(x)        (((x) & TK_DOUBLE) != 0)
  118. #define TK_HAS_ACCUM(x)        (((x) & TK_ACCUM) != 0)
  119. #define TK_HAS_ALPHA(x)        (((x) & TK_ALPHA) != 0)
  120. #define TK_HAS_DEPTH(x)        (((x) & TK_DEPTH) != 0)
  121. #define TK_HAS_STENCIL(x)    (((x) & TK_STENCIL) != 0)
  122. #define TK_IS_INDIRECT(x)    (((x) & TK_INDIRECT) != 0)
  123. #define TK_IS_DIRECT(x)        (((x) & TK_INDIRECT) == 0)
  124.  
  125. /*
  126. ** Event Status
  127. */
  128.  
  129. #define    TK_LEFTBUTTON        1
  130. #define    TK_RIGHTBUTTON        2
  131. #define    TK_MIDDLEBUTTON        4
  132. #define    TK_SHIFT        1
  133. #define    TK_CONTROL        2
  134.  
  135. /* 
  136. ** Key Codes
  137. */
  138.  
  139. #define TK_RETURN        0x0D
  140. #define TK_ESCAPE        0x1B
  141. #define TK_SPACE        0x20
  142. #define TK_LEFT            0x25
  143. #define TK_UP            0x26
  144. #define TK_RIGHT        0x27
  145. #define TK_DOWN            0x28
  146. #define TK_A            'A'
  147. #define TK_B            'B'
  148. #define TK_C            'C'
  149. #define TK_D            'D'
  150. #define TK_E            'E'
  151. #define TK_F            'F'
  152. #define TK_G            'G'
  153. #define TK_H            'H'
  154. #define TK_I            'I'
  155. #define TK_J            'J'
  156. #define TK_K            'K'
  157. #define TK_L            'L'
  158. #define TK_M            'M'
  159. #define TK_N            'N'
  160. #define TK_O            'O'
  161. #define TK_P            'P'
  162. #define TK_Q            'Q'
  163. #define TK_R            'R'
  164. #define TK_S            'S'
  165. #define TK_T            'T'
  166. #define TK_U            'U'
  167. #define TK_V            'V'
  168. #define TK_W            'W'
  169. #define TK_X            'X'
  170. #define TK_Y            'Y'
  171. #define TK_Z            'Z'
  172. #define TK_a            'a'
  173. #define TK_b            'b'
  174. #define TK_c            'c'
  175. #define TK_d            'd'
  176. #define TK_e            'e'
  177. #define TK_f            'f'
  178. #define TK_g            'g'
  179. #define TK_h            'h'
  180. #define TK_i            'i'
  181. #define TK_j            'j'
  182. #define TK_k            'k'
  183. #define TK_l            'l'
  184. #define TK_m            'm'
  185. #define TK_n            'n'
  186. #define TK_o            'o'
  187. #define TK_p            'p'
  188. #define TK_q            'q'
  189. #define TK_r            'r'
  190. #define TK_s            's'
  191. #define TK_t            't'
  192. #define TK_u            'u'
  193. #define TK_v            'v'
  194. #define TK_w            'w'
  195. #define TK_x            'x'
  196. #define TK_y            'y'
  197. #define TK_z            'z'
  198. #define TK_0            '0'
  199. #define TK_1            '1'
  200. #define TK_2            '2'
  201. #define TK_3            '3'
  202. #define TK_4            '4'
  203. #define TK_5            '5'
  204. #define TK_6            '6'
  205. #define TK_7            '7'
  206. #define TK_8            '8'
  207. #define TK_9            '9'
  208.  
  209. /*
  210. ** Color Macros
  211. */
  212.  
  213. enum {
  214.     TK_BLACK = 0,
  215.     TK_RED,
  216.     TK_GREEN,
  217.     TK_YELLOW,
  218.     TK_BLUE,
  219.     TK_MAGENTA,
  220.     TK_CYAN,
  221.     TK_WHITE
  222. };
  223.  
  224. extern float tkRGBMap[8][3];
  225.  
  226. #define TK_SETCOLOR(x, y) (TK_IS_RGB((x)) ? \
  227.                    glColor3fv(tkRGBMap[(y)]) : glIndexf((y)))
  228.  
  229. /*
  230. ** RGB Image Structure
  231. */
  232.  
  233. typedef struct _TK_RGBImageRec {
  234.     GLint sizeX, sizeY;
  235.     unsigned char *data;
  236. } TK_RGBImageRec;
  237.  
  238. /*
  239. ** Prototypes
  240. */
  241.  
  242. extern void APIENTRY tkInitDisplayMode(GLenum);
  243. extern void APIENTRY tkInitPosition(int, int, int, int);
  244. extern GLenum APIENTRY tkInitWindow(char *);
  245. extern void APIENTRY tkCloseWindow(void);
  246. extern void APIENTRY tkQuit(void);
  247. extern void APIENTRY tkClipBoard(void);
  248.  
  249. extern void APIENTRY tkExec(void);
  250. extern void APIENTRY tkExposeFunc(void (*)(int, int));
  251. extern void APIENTRY tkReshapeFunc(void (*)(int, int));
  252. extern void APIENTRY tkDisplayFunc(void (*)(void));
  253. extern void APIENTRY tkKeyDownFunc(GLenum (*)(int, GLenum));
  254. extern void APIENTRY tkMouseDownFunc(GLenum (*)(int, int, GLenum));
  255. extern void APIENTRY tkMouseUpFunc(GLenum (*)(int, int, GLenum));
  256. extern void APIENTRY tkMouseMoveFunc(GLenum (*)(int, int, GLenum));
  257. extern void APIENTRY tkIdleFunc(void (*)(void));
  258.  
  259. extern void APIENTRY tkSwapBuffers(void);
  260.  
  261. extern GLint APIENTRY tkGetColorMapSize(void);
  262. extern void APIENTRY tkGetMouseLoc(int *, int *);
  263. extern HAB * APIENTRY tkGetHAB(void);
  264. extern HWND APIENTRY tkGetCurrentWindow(void);
  265.  
  266. extern void APIENTRY tkSetOneColor(int, float, float, float);
  267. extern void APIENTRY tkSetFogRamp(int, int);
  268. extern void APIENTRY tkSetGreyRamp(void);
  269. extern void APIENTRY tkSetRGBMap(int, float *);
  270.  
  271. extern TK_RGBImageRec * APIENTRY tkRGBImageLoad(char *);
  272.  
  273. extern GLenum APIENTRY tkCreateStrokeFont(GLuint);
  274. extern GLenum APIENTRY tkCreateOutlineFont(GLuint);
  275. extern GLenum APIENTRY tkCreateFilledFont(GLuint);
  276. extern GLenum APIENTRY tkCreateBitmapFont(GLuint);
  277. extern void APIENTRY tkDrawStr(GLuint, char *);
  278.