home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / gl / glaux.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  12KB  |  374 lines

  1. /*++ BUILD Version: 0004    // Increment this if a change has global effects
  2.  
  3. Copyright (c) 1985-95, Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     glaux.h
  8.  
  9. Abstract:
  10.  
  11.     Procedure declarations, constant definitions and macros for the OpenGL
  12.     Auxiliary Library.
  13.  
  14. --*/
  15.  
  16. #ifndef __GLAUX_H__
  17. #define __GLAUX_H__
  18.  
  19. /*
  20.  * (c) Copyright 1993, Silicon Graphics, Inc.
  21.  * ALL RIGHTS RESERVED 
  22.  * Permission to use, copy, modify, and distribute this software for 
  23.  * any purpose and without fee is hereby granted, provided that the above
  24.  * copyright notice appear in all copies and that both the copyright notice
  25.  * and this permission notice appear in supporting documentation, and that 
  26.  * the name of Silicon Graphics, Inc. not be used in advertising
  27.  * or publicity pertaining to distribution of the software without specific,
  28.  * written prior permission. 
  29.  *
  30.  * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
  31.  * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
  32.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
  33.  * FITNESS FOR A PARTICULAR PURPOSE.  IN NO EVENT SHALL SILICON
  34.  * GRAPHICS, INC.  BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
  35.  * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
  36.  * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
  37.  * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
  38.  * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC.  HAS BEEN
  39.  * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
  40.  * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
  41.  * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
  42.  * 
  43.  * US Government Users Restricted Rights 
  44.  * Use, duplication, or disclosure by the Government is subject to
  45.  * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
  46.  * (c)(1)(ii) of the Rights in Technical Data and Computer Software
  47.  * clause at DFARS 252.227-7013 and/or in similar or successor
  48.  * clauses in the FAR or the DOD or NASA FAR Supplement.
  49.  * Unpublished-- rights reserved under the copyright laws of the
  50.  * United States.  Contractor/manufacturer is Silicon Graphics,
  51.  * Inc., 2011 N.  Shoreline Blvd., Mountain View, CA 94039-7311.
  52.  *
  53.  * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
  54.  */
  55.  
  56. #include <windows.h>
  57. #include <GL/gl.h>
  58. #include <GL/glu.h>
  59.  
  60. #ifdef __cplusplus
  61. extern "C" {
  62. #endif
  63.  
  64. /*
  65. ** ToolKit Window Types
  66. ** In the future, AUX_RGBA may be a combination of both RGB and ALPHA
  67. */
  68.  
  69. #define AUX_RGB             0
  70. #define AUX_RGBA            AUX_RGB
  71. #define AUX_INDEX           1
  72. #define AUX_SINGLE          0
  73. #define AUX_DOUBLE          2
  74. #define AUX_DIRECT          0
  75. #define AUX_INDIRECT        4
  76.  
  77. #define AUX_ACCUM           8
  78. #define AUX_ALPHA           16
  79. #define AUX_DEPTH24         32      /* 24-bit depth buffer */
  80. #define AUX_STENCIL         64
  81. #define AUX_AUX             128
  82. #define AUX_DEPTH16         256     /* 16-bit depth buffer */
  83. #define AUX_FIXED_332_PAL   512
  84. #define AUX_DEPTH           AUX_DEPTH16 /* default is 16-bit depth buffer */
  85.  
  86. /* 
  87. ** Window Masks
  88. */
  89.  
  90. #define AUX_WIND_IS_RGB(x)      (((x) & AUX_INDEX) == 0)
  91. #define AUX_WIND_IS_INDEX(x)    (((x) & AUX_INDEX) != 0)
  92. #define AUX_WIND_IS_SINGLE(x)   (((x) & AUX_DOUBLE) == 0)
  93. #define AUX_WIND_IS_DOUBLE(x)   (((x) & AUX_DOUBLE) != 0)
  94. #define AUX_WIND_IS_INDIRECT(x) (((x) & AUX_INDIRECT) != 0)
  95. #define AUX_WIND_IS_DIRECT(x)   (((x) & AUX_INDIRECT) == 0)
  96. #define AUX_WIND_HAS_ACCUM(x)   (((x) & AUX_ACCUM) != 0)
  97. #define AUX_WIND_HAS_ALPHA(x)   (((x) & AUX_ALPHA) != 0)
  98. #define AUX_WIND_HAS_DEPTH(x)   (((x) & (AUX_DEPTH24 | AUX_DEPTH16)) != 0)
  99. #define AUX_WIND_HAS_STENCIL(x) (((x) & AUX_STENCIL) != 0)
  100. #define AUX_WIND_USES_FIXED_332_PAL(x)  (((x) & AUX_FIXED_332_PAL) != 0)
  101.  
  102. /*
  103. ** ToolKit Event Structure
  104. */
  105.  
  106. typedef struct _AUX_EVENTREC {
  107.     GLint event;
  108.     GLint data[4];
  109. } AUX_EVENTREC;
  110.  
  111. /* 
  112. ** ToolKit Event Types
  113. */
  114. #define AUX_EXPOSE      1
  115. #define AUX_CONFIG      2
  116. #define AUX_DRAW        4
  117. #define AUX_KEYEVENT    8
  118. #define AUX_MOUSEDOWN   16
  119. #define AUX_MOUSEUP     32
  120. #define AUX_MOUSELOC    64
  121.  
  122. /*
  123. ** Toolkit Event Data Indices
  124. */
  125. #define AUX_WINDOWX             0
  126. #define AUX_WINDOWY             1
  127. #define AUX_MOUSEX              0
  128. #define AUX_MOUSEY              1
  129. #define AUX_MOUSESTATUS         3
  130. #define AUX_KEY                 0
  131. #define AUX_KEYSTATUS           1
  132.  
  133. /*
  134. ** ToolKit Event Status Messages
  135. */
  136. #define AUX_LEFTBUTTON          1
  137. #define AUX_RIGHTBUTTON         2
  138. #define AUX_MIDDLEBUTTON        4
  139. #define AUX_SHIFT               1
  140. #define AUX_CONTROL             2
  141.  
  142. /* 
  143. ** ToolKit Key Codes
  144. */
  145. #define AUX_RETURN              0x0D
  146. #define AUX_ESCAPE              0x1B
  147. #define AUX_SPACE               0x20
  148. #define AUX_LEFT                0x25
  149. #define AUX_UP                  0x26
  150. #define AUX_RIGHT               0x27
  151. #define AUX_DOWN                0x28
  152. #define AUX_A                   'A'
  153. #define AUX_B                   'B'
  154. #define AUX_C                   'C'
  155. #define AUX_D                   'D'
  156. #define AUX_E                   'E'
  157. #define AUX_F                   'F'
  158. #define AUX_G                   'G'
  159. #define AUX_H                   'H'
  160. #define AUX_I                   'I'
  161. #define AUX_J                   'J'
  162. #define AUX_K                   'K'
  163. #define AUX_L                   'L'
  164. #define AUX_M                   'M'
  165. #define AUX_N                   'N'
  166. #define AUX_O                   'O'
  167. #define AUX_P                   'P'
  168. #define AUX_Q                   'Q'
  169. #define AUX_R                   'R'
  170. #define AUX_S                   'S'
  171. #define AUX_T                   'T'
  172. #define AUX_U                   'U'
  173. #define AUX_V                   'V'
  174. #define AUX_W                   'W'
  175. #define AUX_X                   'X'
  176. #define AUX_Y                   'Y'
  177. #define AUX_Z                   'Z'
  178. #define AUX_a                   'a'
  179. #define AUX_b                   'b'
  180. #define AUX_c                   'c'
  181. #define AUX_d                   'd'
  182. #define AUX_e                   'e'
  183. #define AUX_f                   'f'
  184. #define AUX_g                   'g'
  185. #define AUX_h                   'h'
  186. #define AUX_i                   'i'
  187. #define AUX_j                   'j'
  188. #define AUX_k                   'k'
  189. #define AUX_l                   'l'
  190. #define AUX_m                   'm'
  191. #define AUX_n                   'n'
  192. #define AUX_o                   'o'
  193. #define AUX_p                   'p'
  194. #define AUX_q                   'q'
  195. #define AUX_r                   'r'
  196. #define AUX_s                   's'
  197. #define AUX_t                   't'
  198. #define AUX_u                   'u'
  199. #define AUX_v                   'v'
  200. #define AUX_w                   'w'
  201. #define AUX_x                   'x'
  202. #define AUX_y                   'y'
  203. #define AUX_z                   'z'
  204. #define AUX_0                   '0'
  205. #define AUX_1                   '1'
  206. #define AUX_2                   '2'
  207. #define AUX_3                   '3'
  208. #define AUX_4                   '4'
  209. #define AUX_5                   '5'
  210. #define AUX_6                   '6'
  211. #define AUX_7                   '7'
  212. #define AUX_8                   '8'
  213. #define AUX_9                   '9'
  214.  
  215. /*
  216. ** ToolKit Gets and Sets
  217. */
  218. #define AUX_FD                  1  /* return fd (long) */
  219. #define AUX_COLORMAP            3  /* pass buf of r, g and b (unsigned char) */
  220. #define AUX_GREYSCALEMAP        4
  221. #define AUX_FOGMAP              5  /* pass fog and color bits (long) */
  222. #define AUX_ONECOLOR            6  /* pass index, r, g, and b (long) */
  223.  
  224. /*
  225. ** Color Macros
  226. */
  227.  
  228. #define AUX_BLACK               0
  229. #define AUX_RED                 13
  230. #define AUX_GREEN               14
  231. #define AUX_YELLOW              15
  232. #define AUX_BLUE                16
  233. #define AUX_MAGENTA             17
  234. #define AUX_CYAN                18
  235. #define AUX_WHITE               19
  236.  
  237. extern float auxRGBMap[20][3];
  238.  
  239. #define AUX_SETCOLOR(x, y) (AUX_WIND_IS_RGB((x)) ? \
  240.                            glColor3fv(auxRGBMap[(y)]) : glIndexf((y)))
  241.  
  242. /*
  243. ** RGB Image Structure
  244. */
  245.  
  246. typedef struct _AUX_RGBImageRec {
  247.     GLint sizeX, sizeY;
  248.     unsigned char *data;
  249. } AUX_RGBImageRec;
  250.  
  251. /*
  252. ** Prototypes
  253. */
  254.  
  255. void APIENTRY auxInitDisplayMode(GLenum);
  256. void APIENTRY auxInitPosition(int, int, int, int);
  257.  
  258. /* GLenum APIENTRY auxInitWindow(LPCTSTR); */
  259. #ifdef UNICODE
  260. #define auxInitWindow auxInitWindowW
  261. #else
  262. #define auxInitWindow auxInitWindowA
  263. #endif
  264. GLenum APIENTRY auxInitWindowA(LPCSTR);
  265. GLenum APIENTRY auxInitWindowW(LPCWSTR);
  266.  
  267. void APIENTRY auxCloseWindow(void);
  268. void APIENTRY auxQuit(void);
  269. void APIENTRY auxSwapBuffers(void);
  270.  
  271. typedef void (CALLBACK* AUXMAINPROC)(void);
  272. void APIENTRY auxMainLoop(AUXMAINPROC);
  273.  
  274. typedef void (CALLBACK* AUXEXPOSEPROC)(int, int);
  275. void APIENTRY auxExposeFunc(AUXEXPOSEPROC);
  276.  
  277. typedef void (CALLBACK* AUXRESHAPEPROC)(GLsizei, GLsizei);
  278. void APIENTRY auxReshapeFunc(AUXRESHAPEPROC);
  279.  
  280. typedef void (CALLBACK* AUXIDLEPROC)(void);
  281. void APIENTRY auxIdleFunc(AUXIDLEPROC);
  282.  
  283. typedef void (CALLBACK* AUXKEYPROC)(void);
  284. void APIENTRY auxKeyFunc(int, AUXKEYPROC);
  285.  
  286. typedef void (CALLBACK* AUXMOUSEPROC)(AUX_EVENTREC *);
  287. void APIENTRY auxMouseFunc(int, int, AUXMOUSEPROC);
  288.  
  289. int  APIENTRY auxGetColorMapSize(void);
  290. void APIENTRY auxGetMouseLoc(int *, int *);
  291. void APIENTRY auxSetOneColor(int, float, float, float);
  292. void APIENTRY auxSetFogRamp(int, int);
  293. void APIENTRY auxSetGreyRamp(void);
  294. void APIENTRY auxSetRGBMap(int, float *);
  295.  
  296. /* AUX_RGBImageRec * APIENTRY auxRGBImageLoad(LPCTSTR); */
  297. #ifdef UNICODE
  298. #define auxRGBImageLoad auxRGBImageLoadW
  299. #else
  300. #define auxRGBImageLoad auxRGBImageLoadA
  301. #endif
  302. AUX_RGBImageRec * APIENTRY auxRGBImageLoadA(LPCSTR);
  303. AUX_RGBImageRec * APIENTRY auxRGBImageLoadW(LPCWSTR);
  304.  
  305. #ifdef UNICODE
  306. #define auxDIBImageLoad auxDIBImageLoadW
  307. #else
  308. #define auxDIBImageLoad auxDIBImageLoadA
  309. #endif
  310. AUX_RGBImageRec * APIENTRY auxDIBImageLoadA(LPCSTR);
  311. AUX_RGBImageRec * APIENTRY auxDIBImageLoadW(LPCWSTR);
  312.  
  313. void APIENTRY auxCreateFont(void);
  314. /* void APIENTRY auxDrawStr(LPCTSTR); */
  315. #ifdef UNICODE
  316. #define auxDrawStr auxDrawStrW
  317. #else
  318. #define auxDrawStr auxDrawStrA
  319. #endif
  320. void APIENTRY auxDrawStrA(LPCSTR);
  321. void APIENTRY auxDrawStrW(LPCWSTR);
  322.  
  323. void APIENTRY auxWireSphere(GLdouble);
  324. void APIENTRY auxSolidSphere(GLdouble);
  325. void APIENTRY auxWireCube(GLdouble);
  326. void APIENTRY auxSolidCube(GLdouble);
  327. void APIENTRY auxWireBox(GLdouble, GLdouble, GLdouble);
  328. void APIENTRY auxSolidBox(GLdouble, GLdouble, GLdouble);
  329. void APIENTRY auxWireTorus(GLdouble, GLdouble);
  330. void APIENTRY auxSolidTorus(GLdouble, GLdouble);
  331. void APIENTRY auxWireCylinder(GLdouble, GLdouble);
  332. void APIENTRY auxSolidCylinder(GLdouble, GLdouble);
  333. void APIENTRY auxWireIcosahedron(GLdouble);
  334. void APIENTRY auxSolidIcosahedron(GLdouble);
  335. void APIENTRY auxWireOctahedron(GLdouble);
  336. void APIENTRY auxSolidOctahedron(GLdouble);
  337. void APIENTRY auxWireTetrahedron(GLdouble);
  338. void APIENTRY auxSolidTetrahedron(GLdouble);
  339. void APIENTRY auxWireDodecahedron(GLdouble);
  340. void APIENTRY auxSolidDodecahedron(GLdouble);
  341. void APIENTRY auxWireCone(GLdouble, GLdouble);
  342. void APIENTRY auxSolidCone(GLdouble, GLdouble);
  343. void APIENTRY auxWireTeapot(GLdouble);
  344. void APIENTRY auxSolidTeapot(GLdouble);
  345.  
  346. /*
  347. ** Window specific functions
  348. ** hwnd, hdc, and hglrc valid after auxInitWindow()
  349. */
  350. HWND  APIENTRY auxGetHWND(void);
  351. HDC   APIENTRY auxGetHDC(void);
  352. HGLRC APIENTRY auxGetHGLRC(void);
  353.  
  354. /*
  355. ** Viewperf support functions and constants
  356. */
  357. /* Display Mode Selection Criteria */
  358. enum {
  359.     AUX_USE_ID = 1,
  360.     AUX_EXACT_MATCH,
  361.     AUX_MINIMUM_CRITERIA
  362. };
  363. void   APIENTRY auxInitDisplayModePolicy(GLenum);
  364. GLenum APIENTRY auxInitDisplayModeID(GLint);
  365. GLenum APIENTRY auxGetDisplayModePolicy(void);
  366. GLint  APIENTRY auxGetDisplayModeID(void);
  367. GLenum APIENTRY auxGetDisplayMode(void);
  368.  
  369. #ifdef __cplusplus
  370. }
  371. #endif
  372.  
  373. #endif /* __GLAUX_H__ */
  374.