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