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