Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

269 lines
7.1 KiB

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