More Win32 build compliance fixups
[mesa.git] / include / GL / glu.h
1 /* $Id: glu.h,v 1.9 1999/09/19 02:03:18 tjump Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.1
6 * Copyright (C) 1995-1999 Brian Paul
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 * $Log: glu.h,v $
26 * Revision 1.9 1999/09/19 02:03:18 tjump
27 * More Win32 build compliance fixups
28 *
29 * Revision 1.8 1999/09/17 12:21:36 brianp
30 * glGetProcAddressEXT changes to accomodate Win32 and non-Win32
31 *
32 * Revision 1.7 1999/09/17 02:44:19 tjump
33 * I changed the xxxGetProcAddressEXT function declarations to be more
34 * MSVC friendly. Brianp - could you verify that they describe and operate
35 * as intended on Linux/ETC platforms?
36 *
37 * Revision 1.6 1999/09/16 16:54:22 brianp
38 * GLU_EXT_get_proc_address clean-up
39 *
40 * Revision 1.5 1999/09/14 03:23:08 gareth
41 * Fixed GLUtriangulatorObj again (spelling).
42 *
43 * Revision 1.4 1999/09/14 01:32:58 gareth
44 * Fixed definition of GLUtriangluatorObj for 1.3 tessellator.
45 *
46 * Revision 1.3 1999/09/11 11:34:21 brianp
47 * added GLU_EXT_get_proc_address
48 *
49 * Revision 1.2 1999/09/10 02:08:18 gareth
50 * Added GLU 1.3 tessellation (except winding rule code).
51 *
52 * Revision 1.1.1.1 1999/08/19 00:55:40 jtg
53 * Imported sources
54 *
55 * Revision 3.6 1999/02/14 03:39:45 brianp
56 * updated for BeOS R4
57 *
58 * Revision 3.5 1999/01/03 03:02:55 brianp
59 * now using GLAPI and GLAPIENTRY keywords, misc Windows changes (Ted Jump)
60 *
61 * Revision 3.4 1998/12/01 02:34:27 brianp
62 * applied Mark Kilgard's patches from November 30, 1998
63 *
64 * Revision 3.3 1998/11/17 01:14:02 brianp
65 * minor changes for OpenStep compilation (pete@ohm.york.ac.uk)
66 *
67 * Revision 3.2 1998/07/26 01:36:27 brianp
68 * changes for Windows compilation per Ted Jump
69 *
70 * Revision 3.1 1998/06/23 00:33:08 brianp
71 * added some WIN32 APIENTRY, CALLBACK stuff (Eric Lassauge)
72 *
73 * Revision 3.0 1998/02/20 05:06:01 brianp
74 * initial rev
75 *
76 */
77
78
79 #ifndef GLU_H
80 #define GLU_H
81
82
83 #if defined(USE_MGL_NAMESPACE)
84 #include "glu_mangle.h"
85 #endif
86
87
88 #ifdef __cplusplus
89 extern "C" {
90 #endif
91
92
93 #include "GL/gl.h"
94
95 /* to facilitate clean DLL building ... */
96 #if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN32__))
97 # if defined(_MSC_VER) && defined(BUILD_GLU32) /* tag specify we're building mesa as a DLL */
98 # define GLUAPI __declspec(dllexport)
99 # elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
100 # define GLUAPI __declspec(dllimport)
101 # else /* for use with static link lib build of Win32 edition only */
102 # define GLUAPI extern
103 # endif /* _STATIC_MESA support */
104 #else
105 # define GLUAPI extern
106 #endif /* WIN32 / CYGWIN32 bracket */
107
108 #ifdef macintosh
109 #pragma enumsalwaysint on
110 #if PRAGMA_IMPORT_SUPPORTED
111 #pragma import on
112 #endif
113 #endif
114
115
116 #define GLU_VERSION_1_1 1
117 #define GLU_VERSION_1_2 1
118
119
120 #define GLU_TRUE GL_TRUE
121 #define GLU_FALSE GL_FALSE
122
123
124 enum {
125 /* Normal vectors */
126 GLU_SMOOTH = 100000,
127 GLU_FLAT = 100001,
128 GLU_NONE = 100002,
129
130 /* Quadric draw styles */
131 GLU_POINT = 100010,
132 GLU_LINE = 100011,
133 GLU_FILL = 100012,
134 GLU_SILHOUETTE = 100013,
135
136 /* Quadric orientation */
137 GLU_OUTSIDE = 100020,
138 GLU_INSIDE = 100021,
139
140 /* Tessellator */
141 GLU_TESS_BEGIN = 100100,
142 GLU_TESS_VERTEX = 100101,
143 GLU_TESS_END = 100102,
144 GLU_TESS_ERROR = 100103,
145 GLU_TESS_EDGE_FLAG = 100104,
146 GLU_TESS_COMBINE = 100105,
147
148 GLU_TESS_BEGIN_DATA = 100106,
149 GLU_TESS_VERTEX_DATA = 100107,
150 GLU_TESS_END_DATA = 100108,
151 GLU_TESS_ERROR_DATA = 100109,
152 GLU_TESS_EDGE_FLAG_DATA = 100110,
153 GLU_TESS_COMBINE_DATA = 100111,
154
155 /* Winding rules */
156 GLU_TESS_WINDING_ODD = 100130,
157 GLU_TESS_WINDING_NONZERO = 100131,
158 GLU_TESS_WINDING_POSITIVE = 100132,
159 GLU_TESS_WINDING_NEGATIVE = 100133,
160 GLU_TESS_WINDING_ABS_GEQ_TWO = 100134,
161
162 /* Tessellation properties */
163 GLU_TESS_WINDING_RULE = 100140,
164 GLU_TESS_BOUNDARY_ONLY = 100141,
165 GLU_TESS_TOLERANCE = 100142,
166
167 /* Tessellation errors */
168 GLU_TESS_ERROR1 = 100151, /* Missing gluBeginPolygon */
169 GLU_TESS_ERROR2 = 100152, /* Missing gluBeginContour */
170 GLU_TESS_ERROR3 = 100153, /* Missing gluEndPolygon */
171 GLU_TESS_ERROR4 = 100154, /* Missing gluEndContour */
172 GLU_TESS_ERROR5 = 100155, /* */
173 GLU_TESS_ERROR6 = 100156, /* */
174 GLU_TESS_ERROR7 = 100157, /* */
175 GLU_TESS_ERROR8 = 100158, /* */
176
177 /* NURBS */
178 GLU_AUTO_LOAD_MATRIX = 100200,
179 GLU_CULLING = 100201,
180 GLU_PARAMETRIC_TOLERANCE= 100202,
181 GLU_SAMPLING_TOLERANCE = 100203,
182 GLU_DISPLAY_MODE = 100204,
183 GLU_SAMPLING_METHOD = 100205,
184 GLU_U_STEP = 100206,
185 GLU_V_STEP = 100207,
186
187 GLU_PATH_LENGTH = 100215,
188 GLU_PARAMETRIC_ERROR = 100216,
189 GLU_DOMAIN_DISTANCE = 100217,
190
191 GLU_MAP1_TRIM_2 = 100210,
192 GLU_MAP1_TRIM_3 = 100211,
193
194 GLU_OUTLINE_POLYGON = 100240,
195 GLU_OUTLINE_PATCH = 100241,
196
197 GLU_NURBS_ERROR1 = 100251, /* spline order un-supported */
198 GLU_NURBS_ERROR2 = 100252, /* too few knots */
199 GLU_NURBS_ERROR3 = 100253, /* valid knot range is empty */
200 GLU_NURBS_ERROR4 = 100254, /* decreasing knot sequence */
201 GLU_NURBS_ERROR5 = 100255, /* knot multiplicity > spline order */
202 GLU_NURBS_ERROR6 = 100256, /* endcurve() must follow bgncurve() */
203 GLU_NURBS_ERROR7 = 100257, /* bgncurve() must precede endcurve() */
204 GLU_NURBS_ERROR8 = 100258, /* ctrlarray or knot vector is NULL */
205 GLU_NURBS_ERROR9 = 100259, /* can't draw pwlcurves */
206 GLU_NURBS_ERROR10 = 100260, /* missing gluNurbsCurve() */
207 GLU_NURBS_ERROR11 = 100261, /* missing gluNurbsSurface() */
208 GLU_NURBS_ERROR12 = 100262, /* endtrim() must precede endsurface() */
209 GLU_NURBS_ERROR13 = 100263, /* bgnsurface() must precede endsurface() */
210 GLU_NURBS_ERROR14 = 100264, /* curve of improper type passed as trim curve */
211 GLU_NURBS_ERROR15 = 100265, /* bgnsurface() must precede bgntrim() */
212 GLU_NURBS_ERROR16 = 100266, /* endtrim() must follow bgntrim() */
213 GLU_NURBS_ERROR17 = 100267, /* bgntrim() must precede endtrim()*/
214 GLU_NURBS_ERROR18 = 100268, /* invalid or missing trim curve*/
215 GLU_NURBS_ERROR19 = 100269, /* bgntrim() must precede pwlcurve() */
216 GLU_NURBS_ERROR20 = 100270, /* pwlcurve referenced twice*/
217 GLU_NURBS_ERROR21 = 100271, /* pwlcurve and nurbscurve mixed */
218 GLU_NURBS_ERROR22 = 100272, /* improper usage of trim data type */
219 GLU_NURBS_ERROR23 = 100273, /* nurbscurve referenced twice */
220 GLU_NURBS_ERROR24 = 100274, /* nurbscurve and pwlcurve mixed */
221 GLU_NURBS_ERROR25 = 100275, /* nurbssurface referenced twice */
222 GLU_NURBS_ERROR26 = 100276, /* invalid property */
223 GLU_NURBS_ERROR27 = 100277, /* endsurface() must follow bgnsurface() */
224 GLU_NURBS_ERROR28 = 100278, /* intersecting or misoriented trim curves */
225 GLU_NURBS_ERROR29 = 100279, /* intersecting trim curves */
226 GLU_NURBS_ERROR30 = 100280, /* UNUSED */
227 GLU_NURBS_ERROR31 = 100281, /* unconnected trim curves */
228 GLU_NURBS_ERROR32 = 100282, /* unknown knot error */
229 GLU_NURBS_ERROR33 = 100283, /* negative vertex count encountered */
230 GLU_NURBS_ERROR34 = 100284, /* negative byte-stride */
231 GLU_NURBS_ERROR35 = 100285, /* unknown type descriptor */
232 GLU_NURBS_ERROR36 = 100286, /* null control point reference */
233 GLU_NURBS_ERROR37 = 100287, /* duplicate point on pwlcurve */
234
235 /* Errors */
236 GLU_INVALID_ENUM = 100900,
237 GLU_INVALID_VALUE = 100901,
238 GLU_OUT_OF_MEMORY = 100902,
239 GLU_INCOMPATIBLE_GL_VERSION = 100903,
240
241 /* New in GLU 1.1 */
242 GLU_VERSION = 100800,
243 GLU_EXTENSIONS = 100801,
244
245 /*** GLU 1.0 tessellation - obsolete! ***/
246
247 /* Contour types */
248 GLU_CW = 100120,
249 GLU_CCW = 100121,
250 GLU_INTERIOR = 100122,
251 GLU_EXTERIOR = 100123,
252 GLU_UNKNOWN = 100124,
253
254 /* Tessellator */
255 GLU_BEGIN = GLU_TESS_BEGIN,
256 GLU_VERTEX = GLU_TESS_VERTEX,
257 GLU_END = GLU_TESS_END,
258 GLU_ERROR = GLU_TESS_ERROR,
259 GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG
260 };
261
262
263 /*
264 * These are the GLU 1.1 typedefs. GLU 1.3 has different ones!
265 */
266 #if defined(__BEOS__)
267 /* The BeOS does something funky and makes these typedefs in one
268 * of its system headers.
269 */
270 #else
271 typedef struct GLUquadric GLUquadricObj;
272 typedef struct GLUnurbs GLUnurbsObj;
273
274 /* FIXME: We need to implement the other 1.3 typedefs - GH */
275 typedef struct GLUtesselator GLUtesselator;
276 typedef GLUtesselator GLUtriangulatorObj;
277 #endif
278
279
280
281 #if defined(__BEOS__) || defined(__QUICKDRAW__)
282 #pragma export on
283 #endif
284
285
286 /*
287 *
288 * Miscellaneous functions
289 *
290 */
291
292 GLUAPI void GLAPIENTRY gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
293 GLdouble centerx, GLdouble centery,
294 GLdouble centerz,
295 GLdouble upx, GLdouble upy, GLdouble upz );
296
297
298 GLUAPI void GLAPIENTRY gluOrtho2D( GLdouble left, GLdouble right,
299 GLdouble bottom, GLdouble top );
300
301
302 GLUAPI void GLAPIENTRY gluPerspective( GLdouble fovy, GLdouble aspect,
303 GLdouble zNear, GLdouble zFar );
304
305
306 GLUAPI void GLAPIENTRY gluPickMatrix( GLdouble x, GLdouble y,
307 GLdouble width, GLdouble height,
308 const GLint viewport[4] );
309
310 GLUAPI GLint GLAPIENTRY gluProject( GLdouble objx, GLdouble objy, GLdouble objz,
311 const GLdouble modelMatrix[16],
312 const GLdouble projMatrix[16],
313 const GLint viewport[4],
314 GLdouble *winx, GLdouble *winy,
315 GLdouble *winz );
316
317 GLUAPI GLint GLAPIENTRY gluUnProject( GLdouble winx, GLdouble winy,
318 GLdouble winz,
319 const GLdouble modelMatrix[16],
320 const GLdouble projMatrix[16],
321 const GLint viewport[4],
322 GLdouble *objx, GLdouble *objy,
323 GLdouble *objz );
324
325 GLUAPI const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode );
326
327
328
329 /*
330 *
331 * Mipmapping and image scaling
332 *
333 */
334
335 GLUAPI GLint GLAPIENTRY gluScaleImage( GLenum format,
336 GLint widthin, GLint heightin,
337 GLenum typein, const void *datain,
338 GLint widthout, GLint heightout,
339 GLenum typeout, void *dataout );
340
341 GLUAPI GLint GLAPIENTRY gluBuild1DMipmaps( GLenum target, GLint components,
342 GLint width, GLenum format,
343 GLenum type, const void *data );
344
345 GLUAPI GLint GLAPIENTRY gluBuild2DMipmaps( GLenum target, GLint components,
346 GLint width, GLint height,
347 GLenum format,
348 GLenum type, const void *data );
349
350
351
352 /*
353 *
354 * Quadrics
355 *
356 */
357
358 GLUAPI GLUquadricObj* GLAPIENTRY gluNewQuadric( void );
359
360 GLUAPI void GLAPIENTRY gluDeleteQuadric( GLUquadricObj *state );
361
362 GLUAPI void GLAPIENTRY gluQuadricDrawStyle( GLUquadricObj *quadObject,
363 GLenum drawStyle );
364
365 GLUAPI void GLAPIENTRY gluQuadricOrientation( GLUquadricObj *quadObject,
366 GLenum orientation );
367
368 GLUAPI void GLAPIENTRY gluQuadricNormals( GLUquadricObj *quadObject,
369 GLenum normals );
370
371 GLUAPI void GLAPIENTRY gluQuadricTexture( GLUquadricObj *quadObject,
372 GLboolean textureCoords );
373
374 GLUAPI void GLAPIENTRY gluQuadricCallback( GLUquadricObj *qobj,
375 GLenum which, void (GLCALLBACK *fn)() );
376
377 GLUAPI void GLAPIENTRY gluCylinder( GLUquadricObj *qobj,
378 GLdouble baseRadius,
379 GLdouble topRadius,
380 GLdouble height,
381 GLint slices, GLint stacks );
382
383 GLUAPI void GLAPIENTRY gluSphere( GLUquadricObj *qobj,
384 GLdouble radius, GLint slices, GLint stacks );
385
386 GLUAPI void GLAPIENTRY gluDisk( GLUquadricObj *qobj,
387 GLdouble innerRadius, GLdouble outerRadius,
388 GLint slices, GLint loops );
389
390 GLUAPI void GLAPIENTRY gluPartialDisk( GLUquadricObj *qobj, GLdouble innerRadius,
391 GLdouble outerRadius, GLint slices,
392 GLint loops, GLdouble startAngle,
393 GLdouble sweepAngle );
394
395
396
397 /*
398 *
399 * Nurbs
400 *
401 */
402
403 GLUAPI GLUnurbsObj* GLAPIENTRY gluNewNurbsRenderer( void );
404
405 GLUAPI void GLAPIENTRY gluDeleteNurbsRenderer( GLUnurbsObj *nobj );
406
407 GLUAPI void GLAPIENTRY gluLoadSamplingMatrices( GLUnurbsObj *nobj,
408 const GLfloat modelMatrix[16],
409 const GLfloat projMatrix[16],
410 const GLint viewport[4] );
411
412 GLUAPI void GLAPIENTRY gluNurbsProperty( GLUnurbsObj *nobj, GLenum property,
413 GLfloat value );
414
415 GLUAPI void GLAPIENTRY gluGetNurbsProperty( GLUnurbsObj *nobj, GLenum property,
416 GLfloat *value );
417
418 GLUAPI void GLAPIENTRY gluBeginCurve( GLUnurbsObj *nobj );
419
420 GLUAPI void GLAPIENTRY gluEndCurve( GLUnurbsObj * nobj );
421
422 GLUAPI void GLAPIENTRY gluNurbsCurve( GLUnurbsObj *nobj, GLint nknots,
423 GLfloat *knot, GLint stride,
424 GLfloat *ctlarray, GLint order,
425 GLenum type );
426
427 GLUAPI void GLAPIENTRY gluBeginSurface( GLUnurbsObj *nobj );
428
429 GLUAPI void GLAPIENTRY gluEndSurface( GLUnurbsObj * nobj );
430
431 GLUAPI void GLAPIENTRY gluNurbsSurface( GLUnurbsObj *nobj,
432 GLint sknot_count, GLfloat *sknot,
433 GLint tknot_count, GLfloat *tknot,
434 GLint s_stride, GLint t_stride,
435 GLfloat *ctlarray,
436 GLint sorder, GLint torder,
437 GLenum type );
438
439 GLUAPI void GLAPIENTRY gluBeginTrim( GLUnurbsObj *nobj );
440
441 GLUAPI void GLAPIENTRY gluEndTrim( GLUnurbsObj *nobj );
442
443 GLUAPI void GLAPIENTRY gluPwlCurve( GLUnurbsObj *nobj, GLint count,
444 GLfloat *array, GLint stride, GLenum type );
445
446 GLUAPI void GLAPIENTRY gluNurbsCallback( GLUnurbsObj *nobj, GLenum which,
447 void (GLCALLBACK *fn)() );
448
449
450
451 /*
452 *
453 * Polygon tessellation
454 *
455 */
456
457 GLUAPI GLUtesselator* GLAPIENTRY gluNewTess( void );
458
459 GLUAPI void GLAPIENTRY gluDeleteTess( GLUtesselator *tobj );
460
461 GLUAPI void GLAPIENTRY gluTessBeginPolygon( GLUtesselator *tobj,
462 void *polygon_data );
463
464 GLUAPI void GLAPIENTRY gluTessBeginContour( GLUtesselator *tobj );
465
466 GLUAPI void GLAPIENTRY gluTessVertex( GLUtesselator *tobj, GLdouble coords[3],
467 void *vertex_data );
468
469 GLUAPI void GLAPIENTRY gluTessEndContour( GLUtesselator *tobj );
470
471 GLUAPI void GLAPIENTRY gluTessEndPolygon( GLUtesselator *tobj );
472
473 GLUAPI void GLAPIENTRY gluTessProperty( GLUtesselator *tobj, GLenum which,
474 GLdouble value );
475
476 GLUAPI void GLAPIENTRY gluTessNormal( GLUtesselator *tobj, GLdouble x,
477 GLdouble y, GLdouble z );
478
479 GLUAPI void GLAPIENTRY gluTessCallback( GLUtesselator *tobj, GLenum which,
480 void (GLCALLBACK *fn)() );
481
482 GLUAPI void GLAPIENTRY gluGetTessProperty( GLUtesselator *tobj, GLenum which,
483 GLdouble *value );
484
485 /*
486 *
487 * Obsolete 1.0 tessellation functions
488 *
489 */
490
491 GLUAPI void GLAPIENTRY gluBeginPolygon( GLUtesselator *tobj );
492
493 GLUAPI void GLAPIENTRY gluNextContour( GLUtesselator *tobj, GLenum type );
494
495 GLUAPI void GLAPIENTRY gluEndPolygon( GLUtesselator *tobj );
496
497
498
499 /*
500 *
501 * New functions in GLU 1.1
502 *
503 */
504
505 GLUAPI const GLubyte* GLAPIENTRY gluGetString( GLenum name );
506
507
508
509 /*
510 * GLU_EXT_get_proc_address extension
511 */
512 /*
513 * WARNING: this extension is not finalized yet! Do not release code
514 * which uses this extension yet! It may change!
515 */
516 #define GLU_EXT_get_proc_address 1
517 #ifdef GLU_EXT_get_proc_address
518 GLUAPI void (GLAPIENTRY *glGetProcAddressEXT(const GLubyte *procName))();
519 #endif
520
521
522 #if defined(__BEOS__) || defined(__QUICKDRAW__)
523 #pragma export off
524 #endif
525
526
527 #ifdef macintosh
528 #pragma enumsalwaysint reset
529 #if PRAGMA_IMPORT_SUPPORTED
530 #pragma import off
531 #endif
532 #endif
533
534
535 #ifdef __cplusplus
536 }
537 #endif
538
539
540 #endif