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