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     glu.h
8 
9 Abstract:
10 
11     Procedure declarations, constant definitions and macros for the OpenGL
12     Utility Library.
13 
14 --*/
15 
16 #ifndef __glu_h__
17 #ifndef __GLU_H__
18 
19 #define __glu_h__
20 #define __GLU_H__
21 
22 #include <GL/gl.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /*
29 ** Copyright 1991-1993, Silicon Graphics, Inc.
30 ** All Rights Reserved.
31 **
32 ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
33 ** the contents of this file may not be disclosed to third parties, copied or
34 ** duplicated in any form, in whole or in part, without the prior written
35 ** permission of Silicon Graphics, Inc.
36 **
37 ** RESTRICTED RIGHTS LEGEND:
38 ** Use, duplication or disclosure by the Government is subject to restrictions
39 ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
40 ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
41 ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
42 ** rights reserved under the Copyright Laws of the United States.
43 */
44 
45 /*
46 ** Return the error string associated with a particular error code.
47 ** This will return 0 for an invalid error code.
48 **
49 ** The generic function prototype that can be compiled for ANSI or Unicode
50 ** is defined as follows:
51 **
52 ** LPCTSTR APIENTRY gluErrorStringWIN (GLenum errCode);
53 */
54 #ifdef UNICODE
55 #define gluErrorStringWIN(errCode) ((LPCSTR)  gluErrorUnicodeStringEXT(errCode))
56 #else
57 #define gluErrorStringWIN(errCode) ((LPCWSTR) gluErrorString(errCode))
58 #endif
59 
60 const GLubyte* APIENTRY gluErrorString (
61     GLenum   errCode);
62 
63 const wchar_t* APIENTRY gluErrorUnicodeStringEXT (
64     GLenum   errCode);
65 
66 const GLubyte* APIENTRY gluGetString (
67     GLenum   name);
68 
69 void APIENTRY gluOrtho2D (
70     GLdouble left,
71     GLdouble right,
72     GLdouble bottom,
73     GLdouble top);
74 
75 void APIENTRY gluPerspective (
76     GLdouble fovy,
77     GLdouble aspect,
78     GLdouble zNear,
79     GLdouble zFar);
80 
81 void APIENTRY gluPickMatrix (
82     GLdouble x,
83     GLdouble y,
84     GLdouble width,
85     GLdouble height,
86     GLint    viewport[4]);
87 
88 void APIENTRY gluLookAt (
89     GLdouble eyex,
90     GLdouble eyey,
91     GLdouble eyez,
92     GLdouble centerx,
93     GLdouble centery,
94     GLdouble centerz,
95     GLdouble upx,
96     GLdouble upy,
97     GLdouble upz);
98 
99 int APIENTRY gluProject (
100     GLdouble        objx,
101     GLdouble        objy,
102     GLdouble        objz,
103     const GLdouble  modelMatrix[16],
104     const GLdouble  projMatrix[16],
105     const GLint     viewport[4],
106     GLdouble        *winx,
107     GLdouble        *winy,
108     GLdouble        *winz);
109 
110 int APIENTRY gluUnProject (
111     GLdouble       winx,
112     GLdouble       winy,
113     GLdouble       winz,
114     const GLdouble modelMatrix[16],
115     const GLdouble projMatrix[16],
116     const GLint    viewport[4],
117     GLdouble       *objx,
118     GLdouble       *objy,
119     GLdouble       *objz);
120 
121 
122 int APIENTRY gluScaleImage (
123     GLenum      format,
124     GLint       widthin,
125     GLint       heightin,
126     GLenum      typein,
127     const void  *datain,
128     GLint       widthout,
129     GLint       heightout,
130     GLenum      typeout,
131     void        *dataout);
132 
133 
134 int APIENTRY gluBuild1DMipmaps (
135     GLenum      target,
136     GLint       components,
137     GLint       width,
138     GLenum      format,
139     GLenum      type,
140     const void  *data);
141 
142 int APIENTRY gluBuild2DMipmaps (
143     GLenum      target,
144     GLint       components,
145     GLint       width,
146     GLint       height,
147     GLenum      format,
148     GLenum      type,
149     const void  *data);
150 
151 #ifdef __cplusplus
152 
153 class GLUnurbs;
154 class GLUquadric;
155 class GLUtesselator;
156 
157 /* backwards compatibility: */
158 typedef class GLUnurbs GLUnurbsObj;
159 typedef class GLUquadric GLUquadricObj;
160 typedef class GLUtesselator GLUtesselatorObj;
161 typedef class GLUtesselator GLUtriangulatorObj;
162 
163 #else
164 
165 typedef struct GLUnurbs GLUnurbs;
166 typedef struct GLUquadric GLUquadric;
167 typedef struct GLUtesselator GLUtesselator;
168 
169 /* backwards compatibility: */
170 typedef struct GLUnurbs GLUnurbsObj;
171 typedef struct GLUquadric GLUquadricObj;
172 typedef struct GLUtesselator GLUtesselatorObj;
173 typedef struct GLUtesselator GLUtriangulatorObj;
174 
175 #endif
176 
177 
178 GLUquadric* APIENTRY gluNewQuadric (void);
179 void APIENTRY gluDeleteQuadric (
180     GLUquadric          *state);
181 
182 void APIENTRY gluQuadricNormals (
183     GLUquadric          *quadObject,
184     GLenum              normals);
185 
186 void APIENTRY gluQuadricTexture (
187     GLUquadric          *quadObject,
188     GLboolean           textureCoords);
189 
190 void APIENTRY gluQuadricOrientation (
191     GLUquadric          *quadObject,
192     GLenum              orientation);
193 
194 void APIENTRY gluQuadricDrawStyle (
195     GLUquadric          *quadObject,
196     GLenum              drawStyle);
197 
198 void APIENTRY gluCylinder (
199     GLUquadric          *qobj,
200     GLdouble            baseRadius,
201     GLdouble            topRadius,
202     GLdouble            height,
203     GLint               slices,
204     GLint               stacks);
205 
206 void APIENTRY gluDisk (
207     GLUquadric          *qobj,
208     GLdouble            innerRadius,
209     GLdouble            outerRadius,
210     GLint               slices,
211     GLint               loops);
212 
213 void APIENTRY gluPartialDisk (
214     GLUquadric          *qobj,
215     GLdouble            innerRadius,
216     GLdouble            outerRadius,
217     GLint               slices,
218     GLint               loops,
219     GLdouble            startAngle,
220     GLdouble            sweepAngle);
221 
222 void APIENTRY gluSphere (
223     GLUquadric          *qobj,
224     GLdouble            radius,
225     GLint               slices,
226     GLint               stacks);
227 
228 void APIENTRY gluQuadricCallback (
229     GLUquadric          *qobj,
230     GLenum              which,
231     void                (CALLBACK* fn)());
232 
233 GLUtesselator* APIENTRY  gluNewTess(
234     void );
235 
236 void APIENTRY  gluDeleteTess(
237     GLUtesselator       *tess );
238 
239 void APIENTRY  gluTessBeginPolygon(
240     GLUtesselator       *tess,
241     void                *polygon_data );
242 
243 void APIENTRY  gluTessBeginContour(
244     GLUtesselator       *tess );
245 
246 void APIENTRY  gluTessVertex(
247     GLUtesselator       *tess,
248     GLdouble            coords[3],
249     void                *data );
250 
251 void APIENTRY  gluTessEndContour(
252     GLUtesselator       *tess );
253 
254 void APIENTRY  gluTessEndPolygon(
255     GLUtesselator       *tess );
256 
257 void APIENTRY  gluTessProperty(
258     GLUtesselator       *tess,
259     GLenum              which,
260     GLdouble            value );
261 
262 void APIENTRY  gluTessNormal(
263     GLUtesselator       *tess,
264     GLdouble            x,
265     GLdouble            y,
266     GLdouble            z );
267 
268 void APIENTRY  gluTessCallback(
269     GLUtesselator       *tess,
270     GLenum              which,
271     void                (CALLBACK *fn)());
272 
273 void APIENTRY  gluGetTessProperty(
274     GLUtesselator       *tess,
275     GLenum              which,
276     GLdouble            *value );
277 
278 GLUnurbs* APIENTRY gluNewNurbsRenderer (void);
279 
280 void APIENTRY gluDeleteNurbsRenderer (
281     GLUnurbs            *nobj);
282 
283 void APIENTRY gluBeginSurface (
284     GLUnurbs            *nobj);
285 
286 void APIENTRY gluBeginCurve (
287     GLUnurbs            *nobj);
288 
289 void APIENTRY gluEndCurve (
290     GLUnurbs            *nobj);
291 
292 void APIENTRY gluEndSurface (
293     GLUnurbs            *nobj);
294 
295 void APIENTRY gluBeginTrim (
296     GLUnurbs            *nobj);
297 
298 void APIENTRY gluEndTrim (
299     GLUnurbs            *nobj);
300 
301 void APIENTRY gluPwlCurve (
302     GLUnurbs            *nobj,
303     GLint               count,
304     GLfloat             *array,
305     GLint               stride,
306     GLenum              type);
307 
308 void APIENTRY gluNurbsCurve (
309     GLUnurbs            *nobj,
310     GLint               nknots,
311     GLfloat             *knot,
312     GLint               stride,
313     GLfloat             *ctlarray,
314     GLint               order,
315     GLenum              type);
316 
317 void APIENTRY
318 gluNurbsSurface(
319     GLUnurbs            *nobj,
320     GLint               sknot_count,
321     float               *sknot,
322     GLint               tknot_count,
323     GLfloat             *tknot,
324     GLint               s_stride,
325     GLint               t_stride,
326     GLfloat             *ctlarray,
327     GLint               sorder,
328     GLint               torder,
329     GLenum              type);
330 
331 void APIENTRY
332 gluLoadSamplingMatrices (
333     GLUnurbs            *nobj,
334     const GLfloat       modelMatrix[16],
335     const GLfloat       projMatrix[16],
336     const GLint         viewport[4] );
337 
338 void APIENTRY
339 gluNurbsProperty (
340     GLUnurbs            *nobj,
341     GLenum              property,
342     GLfloat             value );
343 
344 void APIENTRY
345 gluGetNurbsProperty (
346     GLUnurbs            *nobj,
347     GLenum              property,
348     GLfloat             *value );
349 
350 void APIENTRY
351 gluNurbsCallback (
352     GLUnurbs            *nobj,
353     GLenum              which,
354     void                (CALLBACK* fn)() );
355 
356 
357 /****           Callback function prototypes    ****/
358 
359 /* gluQuadricCallback */
360 typedef void (CALLBACK* GLUquadricErrorProc) (GLenum);
361 
362 /* gluTessCallback */
363 typedef void (CALLBACK* GLUtessBeginProc)        (GLenum);
364 typedef void (CALLBACK* GLUtessEdgeFlagProc)     (GLboolean);
365 typedef void (CALLBACK* GLUtessVertexProc)       (void *);
366 typedef void (CALLBACK* GLUtessEndProc)          (void);
367 typedef void (CALLBACK* GLUtessErrorProc)        (GLenum);
368 typedef void (CALLBACK* GLUtessCombineProc)      (GLdouble[3],
369                                                   void*[4],
370                                                   GLfloat[4],
371                                                   void** );
372 typedef void (CALLBACK* GLUtessBeginDataProc)    (GLenum, void *);
373 typedef void (CALLBACK* GLUtessEdgeFlagDataProc) (GLboolean, void *);
374 typedef void (CALLBACK* GLUtessVertexDataProc)   (void *, void *);
375 typedef void (CALLBACK* GLUtessEndDataProc)      (void *);
376 typedef void (CALLBACK* GLUtessErrorDataProc)    (GLenum, void *);
377 typedef void (CALLBACK* GLUtessCombineDataProc)  (GLdouble[3],
378                                                   void*[4],
379                                                   GLfloat[4],
380                                                   void**,
381                                                   void* );
382 
383 /* gluNurbsCallback */
384 typedef void (CALLBACK* GLUnurbsErrorProc)   (GLenum);
385 
386 
387 /****           Generic constants               ****/
388 
389 /* Version */
390 #define GLU_VERSION_1_1                 1
391 #define GLU_VERSION_1_2                 1
392 
393 /* Errors: (return value 0 = no error) */
394 #define GLU_INVALID_ENUM        100900
395 #define GLU_INVALID_VALUE       100901
396 #define GLU_OUT_OF_MEMORY       100902
397 #define GLU_INCOMPATIBLE_GL_VERSION     100903
398 
399 /* StringName */
400 #define GLU_VERSION             100800
401 #define GLU_EXTENSIONS          100801
402 
403 /* Boolean */
404 #define GLU_TRUE                GL_TRUE
405 #define GLU_FALSE               GL_FALSE
406 
407 
408 /****           Quadric constants               ****/
409 
410 /* QuadricNormal */
411 #define GLU_SMOOTH              100000
412 #define GLU_FLAT                100001
413 #define GLU_NONE                100002
414 
415 /* QuadricDrawStyle */
416 #define GLU_POINT               100010
417 #define GLU_LINE                100011
418 #define GLU_FILL                100012
419 #define GLU_SILHOUETTE          100013
420 
421 /* QuadricOrientation */
422 #define GLU_OUTSIDE             100020
423 #define GLU_INSIDE              100021
424 
425 /* Callback types: */
426 /*      GLU_ERROR               100103 */
427 
428 
429 /****           Tesselation constants           ****/
430 
431 #define GLU_TESS_MAX_COORD              1.0e150
432 
433 /* TessProperty */
434 #define GLU_TESS_WINDING_RULE           100140
435 #define GLU_TESS_BOUNDARY_ONLY          100141
436 #define GLU_TESS_TOLERANCE              100142
437 
438 /* TessWinding */
439 #define GLU_TESS_WINDING_ODD            100130
440 #define GLU_TESS_WINDING_NONZERO        100131
441 #define GLU_TESS_WINDING_POSITIVE       100132
442 #define GLU_TESS_WINDING_NEGATIVE       100133
443 #define GLU_TESS_WINDING_ABS_GEQ_TWO    100134
444 
445 /* TessCallback */
446 #define GLU_TESS_BEGIN          100100  /* void (CALLBACK*)(GLenum    type)  */
447 #define GLU_TESS_VERTEX         100101  /* void (CALLBACK*)(void      *data) */
448 #define GLU_TESS_END            100102  /* void (CALLBACK*)(void)            */
449 #define GLU_TESS_ERROR          100103  /* void (CALLBACK*)(GLenum    errno) */
450 #define GLU_TESS_EDGE_FLAG      100104  /* void (CALLBACK*)(GLboolean boundaryEdge)  */
451 #define GLU_TESS_COMBINE        100105  /* void (CALLBACK*)(GLdouble  coords[3],
452                                                             void      *data[4],
453                                                             GLfloat   weight[4],
454                                                             void      **dataOut)     */
455 #define GLU_TESS_BEGIN_DATA     100106  /* void (CALLBACK*)(GLenum    type,
456                                                             void      *polygon_data) */
457 #define GLU_TESS_VERTEX_DATA    100107  /* void (CALLBACK*)(void      *data,
458                                                             void      *polygon_data) */
459 #define GLU_TESS_END_DATA       100108  /* void (CALLBACK*)(void      *polygon_data) */
460 #define GLU_TESS_ERROR_DATA     100109  /* void (CALLBACK*)(GLenum    errno,
461                                                             void      *polygon_data) */
462 #define GLU_TESS_EDGE_FLAG_DATA 100110  /* void (CALLBACK*)(GLboolean boundaryEdge,
463                                                             void      *polygon_data) */
464 #define GLU_TESS_COMBINE_DATA   100111  /* void (CALLBACK*)(GLdouble  coords[3],
465                                                             void      *data[4],
466                                                             GLfloat   weight[4],
467                                                             void      **dataOut,
468                                                             void      *polygon_data) */
469 
470 /* TessError */
471 #define GLU_TESS_ERROR1     100151
472 #define GLU_TESS_ERROR2     100152
473 #define GLU_TESS_ERROR3     100153
474 #define GLU_TESS_ERROR4     100154
475 #define GLU_TESS_ERROR5     100155
476 #define GLU_TESS_ERROR6     100156
477 #define GLU_TESS_ERROR7     100157
478 #define GLU_TESS_ERROR8     100158
479 
480 #define GLU_TESS_MISSING_BEGIN_POLYGON  GLU_TESS_ERROR1
481 #define GLU_TESS_MISSING_BEGIN_CONTOUR  GLU_TESS_ERROR2
482 #define GLU_TESS_MISSING_END_POLYGON    GLU_TESS_ERROR3
483 #define GLU_TESS_MISSING_END_CONTOUR    GLU_TESS_ERROR4
484 #define GLU_TESS_COORD_TOO_LARGE        GLU_TESS_ERROR5
485 #define GLU_TESS_NEED_COMBINE_CALLBACK  GLU_TESS_ERROR6
486 
487 /****           NURBS constants                 ****/
488 
489 /* NurbsProperty */
490 #define GLU_AUTO_LOAD_MATRIX    100200
491 #define GLU_CULLING             100201
492 #define GLU_SAMPLING_TOLERANCE  100203
493 #define GLU_DISPLAY_MODE        100204
494 #define GLU_PARAMETRIC_TOLERANCE        100202
495 #define GLU_SAMPLING_METHOD             100205
496 #define GLU_U_STEP                      100206
497 #define GLU_V_STEP                      100207
498 
499 /* NurbsSampling */
500 #define GLU_PATH_LENGTH                 100215
501 #define GLU_PARAMETRIC_ERROR            100216
502 #define GLU_DOMAIN_DISTANCE             100217
503 
504 
505 /* NurbsTrim */
506 #define GLU_MAP1_TRIM_2         100210
507 #define GLU_MAP1_TRIM_3         100211
508 
509 /* NurbsDisplay */
510 /*      GLU_FILL                100012 */
511 #define GLU_OUTLINE_POLYGON     100240
512 #define GLU_OUTLINE_PATCH       100241
513 
514 /* NurbsCallback */
515 /*      GLU_ERROR               100103 */
516 
517 /* NurbsErrors */
518 #define GLU_NURBS_ERROR1        100251
519 #define GLU_NURBS_ERROR2        100252
520 #define GLU_NURBS_ERROR3        100253
521 #define GLU_NURBS_ERROR4        100254
522 #define GLU_NURBS_ERROR5        100255
523 #define GLU_NURBS_ERROR6        100256
524 #define GLU_NURBS_ERROR7        100257
525 #define GLU_NURBS_ERROR8        100258
526 #define GLU_NURBS_ERROR9        100259
527 #define GLU_NURBS_ERROR10       100260
528 #define GLU_NURBS_ERROR11       100261
529 #define GLU_NURBS_ERROR12       100262
530 #define GLU_NURBS_ERROR13       100263
531 #define GLU_NURBS_ERROR14       100264
532 #define GLU_NURBS_ERROR15       100265
533 #define GLU_NURBS_ERROR16       100266
534 #define GLU_NURBS_ERROR17       100267
535 #define GLU_NURBS_ERROR18       100268
536 #define GLU_NURBS_ERROR19       100269
537 #define GLU_NURBS_ERROR20       100270
538 #define GLU_NURBS_ERROR21       100271
539 #define GLU_NURBS_ERROR22       100272
540 #define GLU_NURBS_ERROR23       100273
541 #define GLU_NURBS_ERROR24       100274
542 #define GLU_NURBS_ERROR25       100275
543 #define GLU_NURBS_ERROR26       100276
544 #define GLU_NURBS_ERROR27       100277
545 #define GLU_NURBS_ERROR28       100278
546 #define GLU_NURBS_ERROR29       100279
547 #define GLU_NURBS_ERROR30       100280
548 #define GLU_NURBS_ERROR31       100281
549 #define GLU_NURBS_ERROR32       100282
550 #define GLU_NURBS_ERROR33       100283
551 #define GLU_NURBS_ERROR34       100284
552 #define GLU_NURBS_ERROR35       100285
553 #define GLU_NURBS_ERROR36       100286
554 #define GLU_NURBS_ERROR37       100287
555 
556 /****           Backwards compatibility for old tesselator           ****/
557 
558 void APIENTRY   gluBeginPolygon( GLUtesselator *tess );
559 
560 void APIENTRY   gluNextContour(  GLUtesselator *tess,
561                                  GLenum        type );
562 
563 void APIENTRY   gluEndPolygon(   GLUtesselator *tess );
564 
565 /* Contours types -- obsolete! */
566 #define GLU_CW          100120
567 #define GLU_CCW         100121
568 #define GLU_INTERIOR    100122
569 #define GLU_EXTERIOR    100123
570 #define GLU_UNKNOWN     100124
571 
572 /* Names without "TESS_" prefix */
573 #define GLU_BEGIN       GLU_TESS_BEGIN
574 #define GLU_VERTEX      GLU_TESS_VERTEX
575 #define GLU_END         GLU_TESS_END
576 #define GLU_ERROR       GLU_TESS_ERROR
577 #define GLU_EDGE_FLAG   GLU_TESS_EDGE_FLAG
578 
579 #ifdef __cplusplus
580 }
581 #endif
582 
583 #endif /* __GLU_H__ */
584 #endif /* __glu_h__ */
585