home *** CD-ROM | disk | FTP | other *** search
/ Amiga Magazin: Amiga-CD 2000 April & May / AMIGA_2000_04.iso / patches / mesa3.1 / mesa-tk.lha / include / GL / gltk.h
Encoding:
C/C++ Source or Header  |  1998-09-20  |  7.0 KB  |  317 lines

  1. /*
  2.  * $Id: gltk.h,v 1.4 1997/08/19 02:36:22 brianp Exp $ 
  3.  */
  4.  
  5. /*
  6.  * Mesa 3-D graphics library
  7.  * Version:  2.4
  8.  * Copyright (C) 1995-1996  Brian Paul
  9.  *
  10.  * This library is free software; you can redistribute it and/or
  11.  * modify it under the terms of the GNU Library General Public
  12.  * License as published by the Free Software Foundation; either
  13.  * version 2 of the License, or (at your option) any later version.
  14.  *
  15.  * This library is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18.  * Library General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU Library General Public
  21.  * License along with this library; if not, write to the Free
  22.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  */
  24.  
  25. /*
  26.  * This code originated from SGI and was modified for use with Mesa.
  27.  */
  28.  
  29. #ifndef GLTK_INCLUDED
  30. #define GLTK_INCLUDED
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35.  
  36. #ifdef __BEOS__
  37. #include "GL/gl.h"
  38. #include "GL/glu.h"
  39. #else
  40. #include <GL/gl.h>
  41. #include <GL/glu.h>
  42. #endif
  43.  
  44. /*
  45.  * ** Nano Window Toolkit.
  46.  * ** Version 1.1
  47.  */
  48.  
  49. #if defined(__WIN32__) || defined(DOSVGA) || defined(FX)
  50. /*
  51.  * ** Display Mode Selection Criteria
  52.  */
  53.   enum {
  54.     TK_USE_ID = 1,
  55.     TK_EXACT_MATCH,
  56.     TK_MINIMUM_CRITERIA
  57.   };
  58. #endif
  59.  
  60. /*
  61.  * ** Window Types
  62.  */
  63.  
  64. #define TK_RGB        0
  65. #define TK_INDEX    1
  66. #define TK_SINGLE    0
  67. #define TK_DOUBLE    2
  68. #define TK_DIRECT    0
  69. #define TK_INDIRECT    4
  70. #define TK_ACCUM    8
  71. #define TK_ALPHA    16
  72. #define TK_DEPTH    32
  73. #define TK_STENCIL    64
  74. #define TK_OVERLAY    128
  75. #define TK_UNDERLAY    256
  76.  
  77. /*
  78.  * ** Window Masks
  79.  */
  80.  
  81. #define TK_IS_RGB(x)        (((x) & TK_INDEX) == 0)
  82. #define TK_IS_INDEX(x)        (((x) & TK_INDEX) != 0)
  83. #define TK_IS_SINGLE(x)        (((x) & TK_DOUBLE) == 0)
  84. #define TK_IS_DOUBLE(x)        (((x) & TK_DOUBLE) != 0)
  85. #define TK_IS_DIRECT(x)        (((x) & TK_INDIRECT) == 0)
  86. #define TK_IS_INDIRECT(x)    (((x) & TK_INDIRECT) != 0)
  87. #define TK_HAS_ACCUM(x)        (((x) & TK_ACCUM) != 0)
  88. #define TK_HAS_ALPHA(x)        (((x) & TK_ALPHA) != 0)
  89. #define TK_HAS_DEPTH(x)        (((x) & TK_DEPTH) != 0)
  90. #define TK_HAS_OVERLAY(x)    (((x) & TK_OVERLAY) != 0)
  91. #define TK_HAS_UNDERLAY(x)    (((x) & TK_UNDERLAY) != 0)
  92. #define TK_HAS_STENCIL(x)    (((x) & TK_STENCIL) != 0)
  93.  
  94. /*
  95.  * ** Windowing System Specific Gets
  96.  */
  97.  
  98.   typedef enum {
  99.     TK_X_DISPLAY = 1,
  100.     TK_X_WINDOW,
  101.     TK_X_SCREEN,
  102.     TK_X_CONTEXT,
  103. #ifdef    __amigaos__
  104.     TK_AOS_WINDOW,
  105.     TK_AOS_SCREEN,
  106.     TK_AOS_CONTEXT
  107. #endif
  108.   } TKenum;
  109.  
  110. /*
  111.  * ** Event Status
  112.  */
  113.  
  114. #define    TK_LEFTBUTTON        1
  115. #define    TK_RIGHTBUTTON        2
  116. #define    TK_MIDDLEBUTTON        4
  117. #define    TK_SHIFT        1
  118. #define    TK_CONTROL        2
  119.  
  120. /*
  121.  * ** Key Codes
  122.  */
  123.  
  124. #define TK_RETURN        0x0D
  125. #define TK_ESCAPE        0x1B
  126. #define TK_SPACE        0x20
  127. #define TK_LEFT            0x25
  128. #define TK_UP            0x26
  129. #define TK_RIGHT        0x27
  130. #define TK_DOWN            0x28
  131. #define TK_A            'A'
  132. #define TK_B            'B'
  133. #define TK_C            'C'
  134. #define TK_D            'D'
  135. #define TK_E            'E'
  136. #define TK_F            'F'
  137. #define TK_G            'G'
  138. #define TK_H            'H'
  139. #define TK_I            'I'
  140. #define TK_J            'J'
  141. #define TK_K            'K'
  142. #define TK_L            'L'
  143. #define TK_M            'M'
  144. #define TK_N            'N'
  145. #define TK_O            'O'
  146. #define TK_P            'P'
  147. #define TK_Q            'Q'
  148. #define TK_R            'R'
  149. #define TK_S            'S'
  150. #define TK_T            'T'
  151. #define TK_U            'U'
  152. #define TK_V            'V'
  153. #define TK_W            'W'
  154. #define TK_X            'X'
  155. #define TK_Y            'Y'
  156. #define TK_Z            'Z'
  157. #define TK_a            'a'
  158. #define TK_b            'b'
  159. #define TK_c            'c'
  160. #define TK_d            'd'
  161. #define TK_e            'e'
  162. #define TK_f            'f'
  163. #define TK_g            'g'
  164. #define TK_h            'h'
  165. #define TK_i            'i'
  166. #define TK_j            'j'
  167. #define TK_k            'k'
  168. #define TK_l            'l'
  169. #define TK_m            'm'
  170. #define TK_n            'n'
  171. #define TK_o            'o'
  172. #define TK_p            'p'
  173. #define TK_q            'q'
  174. #define TK_r            'r'
  175. #define TK_s            's'
  176. #define TK_t            't'
  177. #define TK_u            'u'
  178. #define TK_v            'v'
  179. #define TK_w            'w'
  180. #define TK_x            'x'
  181. #define TK_y            'y'
  182. #define TK_z            'z'
  183. #define TK_0            '0'
  184. #define TK_1            '1'
  185. #define TK_2            '2'
  186. #define TK_3            '3'
  187. #define TK_4            '4'
  188. #define TK_5            '5'
  189. #define TK_6            '6'
  190. #define TK_7            '7'
  191. #define TK_8            '8'
  192. #define TK_9            '9'
  193.  
  194. /*
  195.  * ** Color Macros
  196.  */
  197.  
  198.   enum {
  199.     TK_BLACK = 0,
  200. #ifdef __WIN32__
  201.     TK_RED = 10,
  202. #else
  203.     TK_RED,
  204. #endif
  205.     TK_GREEN,
  206.     TK_YELLOW,
  207.     TK_BLUE,
  208.     TK_MAGENTA,
  209.     TK_CYAN,
  210.     TK_WHITE
  211.   };
  212.  
  213. #ifdef __BEOS__
  214. #pragma export on
  215. #endif
  216.  
  217. #if defined(__WIN32__) || defined(DOSVGA)
  218.   extern float tkRGBMap[17][3];
  219. #else
  220.   extern float tkRGBMap[8][3];
  221. #endif
  222. extern float colorMaps[];
  223.  
  224. #define TK_SETCOLOR(x, y) (TK_IS_RGB((x)) ? \
  225.                    glColor3fv(tkRGBMap[(y)]) : glIndexf((y)))
  226.  
  227. /*
  228.  * ** RGB Image Structure
  229.  */
  230.  
  231.   typedef struct _TK_RGBImageRec {
  232.     GLint sizeX, sizeY;
  233.     unsigned char *data;
  234.   } TK_RGBImageRec;
  235.  
  236. /*
  237.  * ** Prototypes
  238.  */
  239.  
  240.   extern GLenum tkInitDisplay(void);
  241.   extern void tkInitDisplayModePolicy(GLenum);
  242.   extern void tkInitDisplayMode(GLenum);
  243.   extern GLenum tkInitDisplayModeID(GLint);
  244.   extern void tkInitPosition(int, int, int, int);
  245.   extern GLenum tkInitWindow(char *);
  246.   extern void tkCloseWindow(void);
  247.   extern void tkQuit(void);
  248.  
  249.   extern GLenum tkSetWindowLevel(GLenum);
  250.   extern void tkSwapBuffers(void);
  251.  
  252.   extern void tkExec(void);
  253.   extern void tkExposeFunc(void (*)(int, int));
  254.   extern void tkReshapeFunc(void (*)(int, int));
  255.   extern void tkDisplayFunc(void (*)(void));
  256.   extern void tkKeyDownFunc(GLenum(*)(int, GLenum));
  257.   extern void tkMouseDownFunc(GLenum(*)(int, int, GLenum));
  258.   extern void tkMouseUpFunc(GLenum(*)(int, int, GLenum));
  259.   extern void tkMouseMoveFunc(GLenum(*)(int, int, GLenum));
  260.   extern void tkIdleFunc(void (*)(void));
  261.  
  262.   extern int tkGetColorMapSize(void);
  263.   extern void tkGetMouseLoc(int *, int *);
  264.   extern void tkGetSystem(TKenum, void *);
  265.  
  266.   extern GLint tkGetDisplayModeID(void);
  267.   extern GLint tkGetDisplayModePolicy(void);
  268.   extern GLenum tkGetDisplayMode(void);
  269.  
  270.   extern void tkSetOneColor(int, float, float, float);
  271.   extern void tkSetFogRamp(int, int);
  272.   extern void tkSetGreyRamp(void);
  273.   extern void tkSetRGBMap(int, float *);
  274.   extern void tkSetOverlayMap(int, float *);
  275.  
  276.   extern void tkNewCursor(GLint, GLubyte *, GLubyte *, GLenum, GLenum,
  277.               GLint, GLint);
  278.   extern void tkSetCursor(GLint);
  279.  
  280.   extern TK_RGBImageRec *tkRGBImageLoad(char *);
  281.  
  282.   extern GLenum tkCreateStrokeFont(GLuint);
  283.   extern GLenum tkCreateOutlineFont(GLuint);
  284.   extern GLenum tkCreateFilledFont(GLuint);
  285.   extern GLenum tkCreateBitmapFont(GLuint);
  286.   extern void tkDrawStr(GLuint, char *);
  287.  
  288.   extern void tkWireSphere(GLuint, float);
  289.   extern void tkSolidSphere(GLuint, float);
  290.   extern void tkWireCube(GLuint, float);
  291.   extern void tkSolidCube(GLuint, float);
  292.   extern void tkWireBox(GLuint, float, float, float);
  293.   extern void tkSolidBox(GLuint, float, float, float);
  294.   extern void tkWireTorus(GLuint, float, float);
  295.   extern void tkSolidTorus(GLuint, float, float);
  296.   extern void tkWireCylinder(GLuint, float, float);
  297.   extern void tkSolidCylinder(GLuint, float, float);
  298.   extern void tkWireCone(GLuint, float, float);
  299.   extern void tkSolidCone(GLuint, float, float);
  300.  
  301. #ifdef __BEOS__
  302. #pragma export off
  303. #endif
  304.  
  305. #ifdef __cplusplus
  306. }
  307.  
  308. #endif
  309. #ifdef __WIN32__
  310. #include <windows.h> HWND tkGetHWND(void);
  311.  
  312. #endif                                           /*
  313.                                             * WIN32 
  314.                                             */
  315.  
  316. #endif
  317.