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