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