blob: 394883c548b4fc39beceea8437e4a272418f729c [file] [log] [blame]
Brian Paul0822c101999-11-09 06:16:59 +00001/* $Id: glu.h,v 1.14 1999/11/09 06:17:08 brianp 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
jtgafb833d1999-08-19 00:55:39 +000024#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
34extern "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
Brian Paula6f09fa1999-10-22 10:47:01 +000060#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
jtgafb833d1999-08-19 00:55:39 +000072
73#define GLU_VERSION_1_1 1
Gareth Hughes2856b531999-09-10 02:03:31 +000074#define GLU_VERSION_1_2 1
jtgafb833d1999-08-19 00:55:39 +000075
76
77#define GLU_TRUE GL_TRUE
78#define GLU_FALSE GL_FALSE
79
80
81enum {
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
Gareth Hughes2856b531999-09-10 02:03:31 +000097 /* 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,
jtgafb833d1999-08-19 00:55:39 +0000104
Gareth Hughes2856b531999-09-10 02:03:31 +0000105 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,
jtgafb833d1999-08-19 00:55:39 +0000111
Gareth Hughes2856b531999-09-10 02:03:31 +0000112 /* 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, /* */
jtgafb833d1999-08-19 00:55:39 +0000133
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,
Gareth Hughes2856b531999-09-10 02:03:31 +0000200 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
jtgafb833d1999-08-19 00:55:39 +0000217};
218
219
220/*
Gareth Hughes2856b531999-09-10 02:03:31 +0000221 * These are the GLU 1.1 typedefs. GLU 1.3 has different ones!
jtgafb833d1999-08-19 00:55:39 +0000222 */
223#if defined(__BEOS__)
Gareth Hughes2856b531999-09-10 02:03:31 +0000224 /* The BeOS does something funky and makes these typedefs in one
225 * of its system headers.
226 */
jtgafb833d1999-08-19 00:55:39 +0000227#else
Gareth Hughes2856b531999-09-10 02:03:31 +0000228 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;
Gareth Hughes49e0bc41999-09-14 03:23:08 +0000233 typedef GLUtesselator GLUtriangulatorObj;
jtgafb833d1999-08-19 00:55:39 +0000234#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
249GLUAPI 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
255GLUAPI void GLAPIENTRY gluOrtho2D( GLdouble left, GLdouble right,
256 GLdouble bottom, GLdouble top );
257
258
259GLUAPI void GLAPIENTRY gluPerspective( GLdouble fovy, GLdouble aspect,
260 GLdouble zNear, GLdouble zFar );
261
262
263GLUAPI void GLAPIENTRY gluPickMatrix( GLdouble x, GLdouble y,
264 GLdouble width, GLdouble height,
265 const GLint viewport[4] );
266
267GLUAPI 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
274GLUAPI 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
282GLUAPI const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode );
283
284
285
286/*
287 *
288 * Mipmapping and image scaling
289 *
290 */
291
292GLUAPI GLint GLAPIENTRY gluScaleImage( GLenum format,
Brian Paul0822c101999-11-09 06:16:59 +0000293 GLsizei widthin, GLsizei heightin,
jtgafb833d1999-08-19 00:55:39 +0000294 GLenum typein, const void *datain,
Brian Paul0822c101999-11-09 06:16:59 +0000295 GLsizei widthout, GLsizei heightout,
jtgafb833d1999-08-19 00:55:39 +0000296 GLenum typeout, void *dataout );
297
298GLUAPI GLint GLAPIENTRY gluBuild1DMipmaps( GLenum target, GLint components,
Brian Paul0822c101999-11-09 06:16:59 +0000299 GLsizei width, GLenum format,
jtgafb833d1999-08-19 00:55:39 +0000300 GLenum type, const void *data );
301
302GLUAPI GLint GLAPIENTRY gluBuild2DMipmaps( GLenum target, GLint components,
Brian Paul0822c101999-11-09 06:16:59 +0000303 GLsizei width, GLsizei height,
jtgafb833d1999-08-19 00:55:39 +0000304 GLenum format,
305 GLenum type, const void *data );
306
307
308
309/*
310 *
311 * Quadrics
312 *
313 */
314
315GLUAPI GLUquadricObj* GLAPIENTRY gluNewQuadric( void );
316
317GLUAPI void GLAPIENTRY gluDeleteQuadric( GLUquadricObj *state );
318
319GLUAPI void GLAPIENTRY gluQuadricDrawStyle( GLUquadricObj *quadObject,
320 GLenum drawStyle );
321
322GLUAPI void GLAPIENTRY gluQuadricOrientation( GLUquadricObj *quadObject,
323 GLenum orientation );
324
325GLUAPI void GLAPIENTRY gluQuadricNormals( GLUquadricObj *quadObject,
326 GLenum normals );
327
328GLUAPI void GLAPIENTRY gluQuadricTexture( GLUquadricObj *quadObject,
329 GLboolean textureCoords );
330
331GLUAPI void GLAPIENTRY gluQuadricCallback( GLUquadricObj *qobj,
332 GLenum which, void (GLCALLBACK *fn)() );
333
334GLUAPI void GLAPIENTRY gluCylinder( GLUquadricObj *qobj,
335 GLdouble baseRadius,
336 GLdouble topRadius,
337 GLdouble height,
338 GLint slices, GLint stacks );
339
340GLUAPI void GLAPIENTRY gluSphere( GLUquadricObj *qobj,
341 GLdouble radius, GLint slices, GLint stacks );
342
343GLUAPI void GLAPIENTRY gluDisk( GLUquadricObj *qobj,
344 GLdouble innerRadius, GLdouble outerRadius,
345 GLint slices, GLint loops );
346
347GLUAPI 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
360GLUAPI GLUnurbsObj* GLAPIENTRY gluNewNurbsRenderer( void );
361
362GLUAPI void GLAPIENTRY gluDeleteNurbsRenderer( GLUnurbsObj *nobj );
363
364GLUAPI void GLAPIENTRY gluLoadSamplingMatrices( GLUnurbsObj *nobj,
365 const GLfloat modelMatrix[16],
366 const GLfloat projMatrix[16],
367 const GLint viewport[4] );
368
369GLUAPI void GLAPIENTRY gluNurbsProperty( GLUnurbsObj *nobj, GLenum property,
370 GLfloat value );
371
372GLUAPI void GLAPIENTRY gluGetNurbsProperty( GLUnurbsObj *nobj, GLenum property,
373 GLfloat *value );
374
375GLUAPI void GLAPIENTRY gluBeginCurve( GLUnurbsObj *nobj );
376
377GLUAPI void GLAPIENTRY gluEndCurve( GLUnurbsObj * nobj );
378
379GLUAPI void GLAPIENTRY gluNurbsCurve( GLUnurbsObj *nobj, GLint nknots,
380 GLfloat *knot, GLint stride,
381 GLfloat *ctlarray, GLint order,
382 GLenum type );
383
384GLUAPI void GLAPIENTRY gluBeginSurface( GLUnurbsObj *nobj );
385
386GLUAPI void GLAPIENTRY gluEndSurface( GLUnurbsObj * nobj );
387
388GLUAPI 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
396GLUAPI void GLAPIENTRY gluBeginTrim( GLUnurbsObj *nobj );
397
398GLUAPI void GLAPIENTRY gluEndTrim( GLUnurbsObj *nobj );
399
400GLUAPI void GLAPIENTRY gluPwlCurve( GLUnurbsObj *nobj, GLint count,
401 GLfloat *array, GLint stride, GLenum type );
402
403GLUAPI void GLAPIENTRY gluNurbsCallback( GLUnurbsObj *nobj, GLenum which,
404 void (GLCALLBACK *fn)() );
405
406
407
408/*
409 *
Gareth Hughes2856b531999-09-10 02:03:31 +0000410 * Polygon tessellation
jtgafb833d1999-08-19 00:55:39 +0000411 *
412 */
413
Gareth Hughes2856b531999-09-10 02:03:31 +0000414GLUAPI GLUtesselator* GLAPIENTRY gluNewTess( void );
jtgafb833d1999-08-19 00:55:39 +0000415
Gareth Hughes2856b531999-09-10 02:03:31 +0000416GLUAPI void GLAPIENTRY gluDeleteTess( GLUtesselator *tobj );
jtgafb833d1999-08-19 00:55:39 +0000417
Gareth Hughes2856b531999-09-10 02:03:31 +0000418GLUAPI void GLAPIENTRY gluTessBeginPolygon( GLUtesselator *tobj,
419 void *polygon_data );
jtgafb833d1999-08-19 00:55:39 +0000420
Gareth Hughes2856b531999-09-10 02:03:31 +0000421GLUAPI void GLAPIENTRY gluTessBeginContour( GLUtesselator *tobj );
jtgafb833d1999-08-19 00:55:39 +0000422
Gareth Hughes2856b531999-09-10 02:03:31 +0000423GLUAPI void GLAPIENTRY gluTessVertex( GLUtesselator *tobj, GLdouble coords[3],
424 void *vertex_data );
jtgafb833d1999-08-19 00:55:39 +0000425
Gareth Hughes2856b531999-09-10 02:03:31 +0000426GLUAPI void GLAPIENTRY gluTessEndContour( GLUtesselator *tobj );
jtgafb833d1999-08-19 00:55:39 +0000427
Gareth Hughes2856b531999-09-10 02:03:31 +0000428GLUAPI void GLAPIENTRY gluTessEndPolygon( GLUtesselator *tobj );
429
430GLUAPI void GLAPIENTRY gluTessProperty( GLUtesselator *tobj, GLenum which,
431 GLdouble value );
432
433GLUAPI void GLAPIENTRY gluTessNormal( GLUtesselator *tobj, GLdouble x,
434 GLdouble y, GLdouble z );
435
436GLUAPI void GLAPIENTRY gluTessCallback( GLUtesselator *tobj, GLenum which,
437 void (GLCALLBACK *fn)() );
438
439GLUAPI void GLAPIENTRY gluGetTessProperty( GLUtesselator *tobj, GLenum which,
440 GLdouble *value );
441
442/*
443 *
444 * Obsolete 1.0 tessellation functions
445 *
446 */
447
448GLUAPI void GLAPIENTRY gluBeginPolygon( GLUtesselator *tobj );
449
450GLUAPI void GLAPIENTRY gluNextContour( GLUtesselator *tobj, GLenum type );
451
452GLUAPI void GLAPIENTRY gluEndPolygon( GLUtesselator *tobj );
jtgafb833d1999-08-19 00:55:39 +0000453
454
455
456/*
457 *
458 * New functions in GLU 1.1
459 *
460 */
461
462GLUAPI const GLubyte* GLAPIENTRY gluGetString( GLenum name );
463
464
Brian Paulf893f031999-09-11 11:34:21 +0000465
jtgafb833d1999-08-19 00:55:39 +0000466#if defined(__BEOS__) || defined(__QUICKDRAW__)
467#pragma export off
468#endif
469
470
471#ifdef macintosh
472 #pragma enumsalwaysint reset
473 #if PRAGMA_IMPORT_SUPPORTED
474 #pragma import off
475 #endif
476#endif
477
478
479#ifdef __cplusplus
480}
481#endif
482
483
484#endif