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