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