home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / mesa-1.2.8 / include / glaux.h next >
C/C++ Source or Header  |  1996-05-27  |  8KB  |  331 lines

  1. /* glaux.h */
  2.  
  3. /*
  4.  * Mesa - a 3-D graphics library
  5.  * Version:  1.0 beta
  6.  * Copyright (C) 1995  Brian Paul  (brianp@ssec.wisc.edu)
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25.  * This code originated from SGI and was modified for use with Mesa.
  26.  */
  27.  
  28.  
  29. #ifndef AUX_INCLUDED
  30. #define AUX_INCLUDED
  31.  
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37.  
  38. #if !defined(AMIGA) && !defined(__WIN32__) && !defined(NeXT)
  39. #  include <X11/Xlib.h>
  40. #  include <X11/Xutil.h>
  41. #endif
  42. #include <GL/gl.h>
  43. #include <GL/glu.h>
  44.  
  45. /*
  46. ** ToolKit Window Types
  47. ** In the future, AUX_RGBA may be a combination of both RGB and ALPHA
  48. */
  49.  
  50. #define AUX_RGB        0
  51. #define AUX_RGBA    AUX_RGB
  52. #define AUX_INDEX    1
  53. #define AUX_SINGLE    0
  54. #define AUX_DOUBLE    2
  55. #define AUX_DIRECT    0
  56. #define AUX_INDIRECT    4
  57.  
  58. #define AUX_ACCUM    8
  59. #define AUX_ALPHA    16
  60. #define AUX_DEPTH    32
  61. #define AUX_STENCIL    64
  62. #define AUX_AUX        128
  63.  
  64. /* 
  65. ** Window Masks
  66. */
  67.  
  68. #define AUX_WIND_IS_RGB(x)    (((x) & AUX_INDEX) == 0)
  69. #define AUX_WIND_IS_INDEX(x)    (((x) & AUX_INDEX) != 0)
  70. #define AUX_WIND_IS_SINGLE(x)    (((x) & AUX_DOUBLE) == 0)
  71. #define AUX_WIND_IS_DOUBLE(x)    (((x) & AUX_DOUBLE) != 0)
  72. #define AUX_WIND_IS_INDIRECT(x)    (((x) & AUX_INDIRECT) != 0)
  73. #define AUX_WIND_IS_DIRECT(x)    (((x) & AUX_INDIRECT) == 0)
  74. #define AUX_WIND_HAS_ACCUM(x)    (((x) & AUX_ACCUM) != 0)
  75. #define AUX_WIND_HAS_ALPHA(x)    (((x) & AUX_ALPHA) != 0)
  76. #define AUX_WIND_HAS_DEPTH(x)    (((x) & AUX_DEPTH) != 0)
  77. #define AUX_WIND_HAS_STENCIL(x)    (((x) & AUX_STENCIL) != 0)
  78.  
  79. /*
  80. ** Display Mode Selection Criteria
  81. */
  82.  
  83. enum {
  84.     AUX_USE_ID = 1,
  85.     AUX_EXACT_MATCH,
  86.     AUX_MINIMUM_CRITERIA
  87. };
  88.  
  89.  
  90. #define AUX_OFF 0
  91. #define AUX_ON 1
  92.  
  93.  
  94. /*
  95. ** ToolKit Event Structure
  96. */
  97.  
  98. typedef struct _AUX_EVENTREC {
  99.     GLint event;
  100.     GLint data[4];
  101. } AUX_EVENTREC;
  102.  
  103. /* 
  104. ** ToolKit Event Types
  105. */
  106. #define AUX_EXPOSE    1
  107. #define AUX_CONFIG    2
  108. #define AUX_DRAW    4
  109. #define AUX_KEYEVENT    8
  110. #define AUX_MOUSEDOWN    16
  111. #define AUX_MOUSEUP    32    
  112. #define AUX_MOUSELOC    64
  113.  
  114. /*
  115. ** Toolkit Event Data Indices
  116. */
  117. #define AUX_WINDOWX        0
  118. #define AUX_WINDOWY        1
  119. #define AUX_MOUSEX        0
  120. #define AUX_MOUSEY        1
  121. #define AUX_MOUSESTATUS        3
  122. #define AUX_KEY            0
  123. #define AUX_KEYSTATUS        1
  124.  
  125. /*
  126. ** ToolKit Event Status Messages
  127. */
  128. #define    AUX_LEFTBUTTON        1
  129. #define    AUX_RIGHTBUTTON        2
  130. #define    AUX_MIDDLEBUTTON    4
  131. #define    AUX_SHIFT        1
  132. #define    AUX_CONTROL        2
  133.  
  134. /* 
  135. ** ToolKit Key Codes
  136. */
  137. #define AUX_RETURN        0x0D
  138. #define AUX_ESCAPE        0x1B
  139. #define AUX_SPACE        0x20
  140. #define AUX_LEFT        0x25
  141. #define AUX_UP            0x26
  142. #define AUX_RIGHT        0x27
  143. #define AUX_DOWN        0x28
  144. #define AUX_A            'A'
  145. #define AUX_B            'B'
  146. #define AUX_C            'C'
  147. #define AUX_D            'D'
  148. #define AUX_E            'E'
  149. #define AUX_F            'F'
  150. #define AUX_G            'G'
  151. #define AUX_H            'H'
  152. #define AUX_I            'I'
  153. #define AUX_J            'J'
  154. #define AUX_K            'K'
  155. #define AUX_L            'L'
  156. #define AUX_M            'M'
  157. #define AUX_N            'N'
  158. #define AUX_O            'O'
  159. #define AUX_P            'P'
  160. #define AUX_Q            'Q'
  161. #define AUX_R            'R'
  162. #define AUX_S            'S'
  163. #define AUX_T            'T'
  164. #define AUX_U            'U'
  165. #define AUX_V            'V'
  166. #define AUX_W            'W'
  167. #define AUX_X            'X'
  168. #define AUX_Y            'Y'
  169. #define AUX_Z            'Z'
  170. #define AUX_a            'a'
  171. #define AUX_b            'b'
  172. #define AUX_c            'c'
  173. #define AUX_d            'd'
  174. #define AUX_e            'e'
  175. #define AUX_f            'f'
  176. #define AUX_g            'g'
  177. #define AUX_h            'h'
  178. #define AUX_i            'i'
  179. #define AUX_j            'j'
  180. #define AUX_k            'k'
  181. #define AUX_l            'l'
  182. #define AUX_m            'm'
  183. #define AUX_n            'n'
  184. #define AUX_o            'o'
  185. #define AUX_p            'p'
  186. #define AUX_q            'q'
  187. #define AUX_r            'r'
  188. #define AUX_s            's'
  189. #define AUX_t            't'
  190. #define AUX_u            'u'
  191. #define AUX_v            'v'
  192. #define AUX_w            'w'
  193. #define AUX_x            'x'
  194. #define AUX_y            'y'
  195. #define AUX_z            'z'
  196. #define AUX_0            '0'
  197. #define AUX_1            '1'
  198. #define AUX_2            '2'
  199. #define AUX_3            '3'
  200. #define AUX_4            '4'
  201. #define AUX_5            '5'
  202. #define AUX_6            '6'
  203. #define AUX_7            '7'
  204. #define AUX_8            '8'
  205. #define AUX_9            '9'
  206.  
  207. /*
  208. ** ToolKit Gets and Sets
  209. */
  210. #define AUX_FD            1  /* return fd (long) */
  211. #define AUX_COLORMAP        3  /* pass buf of r, g and b (unsigned char) */
  212. #define AUX_GREYSCALEMAP    4
  213. #define AUX_FOGMAP        5  /* pass fog and color bits (long) */
  214. #define AUX_ONECOLOR        6  /* pass index, r, g, and b (long) */
  215.  
  216. /*
  217. ** Color Macros
  218. */
  219.  
  220. enum {
  221.     AUX_BLACK = 0,
  222. #ifdef __WIN32__
  223.     AUX_RED=10,
  224. #else
  225.     AUX_RED,
  226. #endif
  227.     AUX_GREEN,
  228.     AUX_YELLOW,
  229.     AUX_BLUE,
  230.     AUX_MAGENTA,
  231.     AUX_CYAN,
  232.     AUX_WHITE
  233. };
  234.  
  235. #ifdef __WIN32__
  236.    extern float auxRGBMap[17][3];
  237. #else
  238.    extern float auxRGBMap[8][3];
  239. #endif
  240.  
  241. #define AUX_SETCOLOR(x, y) (AUX_WIND_IS_RGB((x)) ? \
  242.                    glColor3fv(auxRGBMap[(y)]) : glIndexf((y)))
  243.  
  244. /*
  245. ** RGB Image Structure
  246. */
  247.  
  248. typedef struct _AUX_RGBImageRec {
  249.     GLint sizeX, sizeY;
  250.     unsigned char *data;
  251. } AUX_RGBImageRec;
  252.  
  253. /*
  254. ** Prototypes
  255. */
  256.  
  257. extern void auxInitDisplayMode(GLbitfield);
  258. extern void auxInitPosition(int, int, int, int);
  259. extern GLenum auxInitWindow(char *);
  260. extern void auxCloseWindow(void);
  261. extern void auxQuit(void);
  262. extern void auxSwapBuffers(void);
  263.  
  264. #if !defined(AMIGA) && !defined(__WIN32__) && !defined(NeXT)
  265. extern Display *auxXDisplay(void);
  266. extern Window auxXWindow(void);
  267. #endif
  268.  
  269. extern void auxMainLoop(void (*)());
  270. extern void auxExposeFunc(void (*)(int, int));
  271. extern void auxReshapeFunc(void (*)(int, int));
  272. extern void auxIdleFunc(void (*)());
  273. extern void auxKeyFunc(int, void (*)());
  274. extern void auxMouseFunc(int, int, void (*)(AUX_EVENTREC *));
  275.  
  276. extern void auxDeleteMouseFunc( int, int , void (*)(AUX_EVENTREC *));
  277.  
  278. extern int auxGetColorMapSize(void);
  279. extern void auxGetMouseLoc(int *, int *);
  280. extern void auxSetOneColor(int, float, float, float);
  281. extern void auxSetFogRamp(int, int);
  282. extern void auxSetGreyRamp(void);
  283. extern void auxSetRGBMap(int, float *);
  284.  
  285. extern AUX_RGBImageRec *auxRGBImageLoad(char *);
  286.  
  287. extern void auxCreateFont(void);
  288. extern void auxDrawStr(char *);
  289.  
  290. extern void auxWireSphere(GLdouble);
  291. extern void auxSolidSphere(GLdouble);
  292. extern void auxWireCube(GLdouble);
  293. extern void auxSolidCube(GLdouble);
  294. extern void auxWireBox(GLdouble, GLdouble, GLdouble);
  295. extern void auxSolidBox(GLdouble, GLdouble, GLdouble);
  296. extern void auxWireTorus(GLdouble, GLdouble);
  297. extern void auxSolidTorus(GLdouble, GLdouble);
  298. extern void auxWireCylinder(GLdouble, GLdouble);
  299. extern void auxSolidCylinder(GLdouble, GLdouble);
  300. extern void auxWireIcosahedron(GLdouble);
  301. extern void auxSolidIcosahedron(GLdouble);
  302. extern void auxWireOctahedron(GLdouble);
  303. extern void auxSolidOctahedron(GLdouble);
  304. extern void auxWireTetrahedron(GLdouble);
  305. extern void auxSolidTetrahedron(GLdouble);
  306. extern void auxWireDodecahedron(GLdouble);
  307. extern void auxSolidDodecahedron(GLdouble);
  308. extern void auxWireCone(GLdouble, GLdouble);
  309. extern void auxSolidCone(GLdouble, GLdouble);
  310. extern void auxWireTeapot(GLdouble);
  311. extern void auxSolidTeapot(GLdouble);
  312.  
  313. /* added for viewperf benchmark */
  314. extern void auxInitDisplayModePolicy( GLenum type );
  315. extern GLenum auxGetDisplayModePolicy( void );
  316. extern GLenum auxInitDisplayModeID( GLint id );
  317. extern GLint auxGetDisplayModeID( void );
  318. extern GLenum auxGetDisplayMode( void );
  319.  
  320. extern void auxGetScreenSize( GLint *width, GLint *height );
  321.  
  322. extern void auxAnimation( GLint flag );
  323.  
  324.  
  325. #ifdef __cplusplus
  326. }
  327. #endif
  328.  
  329.  
  330. #endif /* AUX_INCLUDED */
  331.