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