home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / mesa-1.2.8 / include / gltk.h < prev   
C/C++ Source or Header  |  1996-05-27  |  6KB  |  294 lines

  1. /* gltk.h */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  1.2
  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 GLTK_INCLUDED
  30. #define GLTK_INCLUDED
  31.  
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37.  
  38. #include <GL/gl.h>
  39. #include <GL/glu.h>
  40.  
  41. /*
  42. ** Nano Window Toolkit.
  43. ** Version 1.1
  44. */
  45.  
  46.  
  47. #ifdef __WIN32__
  48. /*
  49. ** Display Mode Selection Criteria
  50. */
  51. enum {
  52.     TK_USE_ID = 1,
  53.     TK_EXACT_MATCH,
  54.     TK_MINIMUM_CRITERIA
  55. };
  56. #endif
  57.  
  58.  
  59. /*
  60. ** Window Types
  61. */
  62.  
  63. #define TK_RGB        0
  64. #define TK_INDEX    1
  65. #define TK_SINGLE    0
  66. #define TK_DOUBLE    2
  67. #define TK_DIRECT    0
  68. #define TK_INDIRECT    4
  69. #define TK_ACCUM    8
  70. #define TK_ALPHA    16
  71. #define TK_DEPTH    32
  72. #define TK_STENCIL    64
  73. #define TK_OVERLAY    128
  74. #define TK_UNDERLAY    256
  75.  
  76. /* 
  77. ** Window Masks
  78. */
  79.  
  80. #define TK_IS_RGB(x)        (((x) & TK_INDEX) == 0)
  81. #define TK_IS_INDEX(x)        (((x) & TK_INDEX) != 0)
  82. #define TK_IS_SINGLE(x)        (((x) & TK_DOUBLE) == 0)
  83. #define TK_IS_DOUBLE(x)        (((x) & TK_DOUBLE) != 0)
  84. #define TK_IS_DIRECT(x)        (((x) & TK_INDIRECT) == 0)
  85. #define TK_IS_INDIRECT(x)    (((x) & TK_INDIRECT) != 0)
  86. #define TK_HAS_ACCUM(x)        (((x) & TK_ACCUM) != 0)
  87. #define TK_HAS_ALPHA(x)        (((x) & TK_ALPHA) != 0)
  88. #define TK_HAS_DEPTH(x)        (((x) & TK_DEPTH) != 0)
  89. #define TK_HAS_OVERLAY(x)    (((x) & TK_OVERLAY) != 0)
  90. #define TK_HAS_UNDERLAY(x)    (((x) & TK_UNDERLAY) != 0)
  91. #define TK_HAS_STENCIL(x)    (((x) & TK_STENCIL) != 0)
  92.  
  93. /*
  94. ** Windowing System Specific Gets
  95. */
  96.  
  97. typedef enum {
  98.     TK_X_DISPLAY = 1,
  99.     TK_X_WINDOW
  100. } TKenum;
  101.  
  102. /*
  103. ** Event Status
  104. */
  105.  
  106. #define    TK_LEFTBUTTON        1
  107. #define    TK_RIGHTBUTTON        2
  108. #define    TK_MIDDLEBUTTON        4
  109. #define    TK_SHIFT        1
  110. #define    TK_CONTROL        2
  111.  
  112. /* 
  113. ** Key Codes
  114. */
  115.  
  116. #define TK_RETURN        0x0D
  117. #define TK_ESCAPE        0x1B
  118. #define TK_SPACE        0x20
  119. #define TK_LEFT            0x25
  120. #define TK_UP            0x26
  121. #define TK_RIGHT        0x27
  122. #define TK_DOWN            0x28
  123. #define TK_A            'A'
  124. #define TK_B            'B'
  125. #define TK_C            'C'
  126. #define TK_D            'D'
  127. #define TK_E            'E'
  128. #define TK_F            'F'
  129. #define TK_G            'G'
  130. #define TK_H            'H'
  131. #define TK_I            'I'
  132. #define TK_J            'J'
  133. #define TK_K            'K'
  134. #define TK_L            'L'
  135. #define TK_M            'M'
  136. #define TK_N            'N'
  137. #define TK_O            'O'
  138. #define TK_P            'P'
  139. #define TK_Q            'Q'
  140. #define TK_R            'R'
  141. #define TK_S            'S'
  142. #define TK_T            'T'
  143. #define TK_U            'U'
  144. #define TK_V            'V'
  145. #define TK_W            'W'
  146. #define TK_X            'X'
  147. #define TK_Y            'Y'
  148. #define TK_Z            'Z'
  149. #define TK_a            'a'
  150. #define TK_b            'b'
  151. #define TK_c            'c'
  152. #define TK_d            'd'
  153. #define TK_e            'e'
  154. #define TK_f            'f'
  155. #define TK_g            'g'
  156. #define TK_h            'h'
  157. #define TK_i            'i'
  158. #define TK_j            'j'
  159. #define TK_k            'k'
  160. #define TK_l            'l'
  161. #define TK_m            'm'
  162. #define TK_n            'n'
  163. #define TK_o            'o'
  164. #define TK_p            'p'
  165. #define TK_q            'q'
  166. #define TK_r            'r'
  167. #define TK_s            's'
  168. #define TK_t            't'
  169. #define TK_u            'u'
  170. #define TK_v            'v'
  171. #define TK_w            'w'
  172. #define TK_x            'x'
  173. #define TK_y            'y'
  174. #define TK_z            'z'
  175. #define TK_0            '0'
  176. #define TK_1            '1'
  177. #define TK_2            '2'
  178. #define TK_3            '3'
  179. #define TK_4            '4'
  180. #define TK_5            '5'
  181. #define TK_6            '6'
  182. #define TK_7            '7'
  183. #define TK_8            '8'
  184. #define TK_9            '9'
  185.  
  186. /*
  187. ** Color Macros
  188. */
  189.  
  190. enum {
  191.     TK_BLACK = 0,
  192. #ifdef __WIN32__
  193.     TK_RED=10,
  194. #else
  195.     TK_RED,
  196. #endif
  197.     TK_GREEN,
  198.     TK_YELLOW,
  199.     TK_BLUE,
  200.     TK_MAGENTA,
  201.     TK_CYAN,
  202.     TK_WHITE
  203. };
  204.  
  205. #ifdef __WIN32__
  206. extern float tkRGBMap[17][3];
  207. #else
  208. extern float tkRGBMap[8][3];
  209. #endif
  210.  
  211. #define TK_SETCOLOR(x, y) (TK_IS_RGB((x)) ? \
  212.                    glColor3fv(tkRGBMap[(y)]) : glIndexf((y)))
  213.  
  214. /*
  215. ** RGB Image Structure
  216. */
  217.  
  218. typedef struct _TK_RGBImageRec {
  219.     GLint sizeX, sizeY;
  220.     unsigned char *data;
  221. } TK_RGBImageRec;
  222.  
  223. /*
  224. ** Prototypes
  225. */
  226.  
  227. extern void tkInitDisplayMode(GLenum);
  228. extern void tkInitPosition(int, int, int, int);
  229. extern GLenum tkInitWindow(char *);
  230. extern void tkCloseWindow(void);
  231. extern void tkQuit(void);
  232.  
  233. extern GLenum tkSetWindowLevel(GLenum);
  234. extern void tkSwapBuffers(void);
  235.  
  236. extern void tkExec(void);
  237. extern void tkExposeFunc(void (*)(int, int));
  238. extern void tkReshapeFunc(void (*)(int, int));
  239. extern void tkDisplayFunc(void (*)(void));
  240. extern void tkKeyDownFunc(GLenum (*)(int, GLenum));
  241. extern void tkMouseDownFunc(GLenum (*)(int, int, GLenum));
  242. extern void tkMouseUpFunc(GLenum (*)(int, int, GLenum));
  243. extern void tkMouseMoveFunc(GLenum (*)(int, int, GLenum));
  244. extern void tkIdleFunc(void (*)(void));
  245.  
  246. extern int tkGetColorMapSize(void);
  247. extern void tkGetMouseLoc(int *, int *);
  248. extern void tkGetSystem(TKenum, void *);
  249.  
  250. extern void tkSetOneColor(int, float, float, float);
  251. extern void tkSetFogRamp(int, int);
  252. extern void tkSetGreyRamp(void);
  253. extern void tkSetRGBMap(int, float *);
  254. extern void tkSetOverlayMap(int, float *);
  255.  
  256. extern void tkNewCursor(GLint, GLubyte *, GLubyte *, GLenum, GLenum,
  257.             GLint, GLint);
  258. extern void tkSetCursor(GLint);
  259.  
  260. extern TK_RGBImageRec *tkRGBImageLoad(char *);
  261.  
  262. extern GLenum tkCreateStrokeFont(GLuint);
  263. extern GLenum tkCreateOutlineFont(GLuint);
  264. extern GLenum tkCreateFilledFont(GLuint);
  265. extern GLenum tkCreateBitmapFont(GLuint);
  266. extern void tkDrawStr(GLuint, char *);
  267.  
  268. extern void tkWireSphere(GLuint, float);
  269. extern void tkSolidSphere(GLuint, float);
  270. extern void tkWireCube(GLuint, float);
  271. extern void tkSolidCube(GLuint, float);
  272. extern void tkWireBox(GLuint, float, float, float);
  273. extern void tkSolidBox(GLuint, float, float, float);
  274. extern void tkWireTorus(GLuint, float, float);
  275. extern void tkSolidTorus(GLuint, float, float);
  276. extern void tkWireCylinder(GLuint, float, float);
  277. extern void tkSolidCylinder(GLuint, float, float);
  278. extern void tkWireCone(GLuint, float, float);
  279. extern void tkSolidCone(GLuint, float, float);
  280.  
  281.  
  282. #ifdef __cplusplus
  283. }
  284. #endif
  285.  
  286.  
  287. #ifdef __WIN32__
  288. #include <windows.h>
  289. HWND tkGetHWND(void);
  290. #endif /* WIN32 */
  291.  
  292.  
  293. #endif
  294.