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