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