1 /* $Id: glu.h,v 1.12 1999/10/22 10:47:58 brianp Exp $ */
4 * Mesa 3-D graphics library
6 * Copyright (C) 1995-1999 Brian Paul
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.
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.
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.
28 #if defined(USE_MGL_NAMESPACE)
29 #include "glu_mangle.h"
40 /* to facilitate clean DLL building ... */
41 #if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN32__))
42 # if defined(_MSC_VER) && defined(BUILD_GLU32) /* tag specify we're building mesa as a DLL */
43 # define GLUAPI __declspec(dllexport)
44 # elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
45 # define GLUAPI __declspec(dllimport)
46 # else /* for use with static link lib build of Win32 edition only */
47 # define GLUAPI extern
48 # endif /* _STATIC_MESA support */
50 # define GLUAPI extern
51 #endif /* WIN32 / CYGWIN32 bracket */
54 #pragma enumsalwaysint on
55 #if PRAGMA_IMPORT_SUPPORTED
73 #define GLU_VERSION_1_1 1
74 #define GLU_VERSION_1_2 1
77 #define GLU_TRUE GL_TRUE
78 #define GLU_FALSE GL_FALSE
87 /* Quadric draw styles */
91 GLU_SILHOUETTE
= 100013,
93 /* Quadric orientation */
98 GLU_TESS_BEGIN
= 100100,
99 GLU_TESS_VERTEX
= 100101,
100 GLU_TESS_END
= 100102,
101 GLU_TESS_ERROR
= 100103,
102 GLU_TESS_EDGE_FLAG
= 100104,
103 GLU_TESS_COMBINE
= 100105,
105 GLU_TESS_BEGIN_DATA
= 100106,
106 GLU_TESS_VERTEX_DATA
= 100107,
107 GLU_TESS_END_DATA
= 100108,
108 GLU_TESS_ERROR_DATA
= 100109,
109 GLU_TESS_EDGE_FLAG_DATA
= 100110,
110 GLU_TESS_COMBINE_DATA
= 100111,
113 GLU_TESS_WINDING_ODD
= 100130,
114 GLU_TESS_WINDING_NONZERO
= 100131,
115 GLU_TESS_WINDING_POSITIVE
= 100132,
116 GLU_TESS_WINDING_NEGATIVE
= 100133,
117 GLU_TESS_WINDING_ABS_GEQ_TWO
= 100134,
119 /* Tessellation properties */
120 GLU_TESS_WINDING_RULE
= 100140,
121 GLU_TESS_BOUNDARY_ONLY
= 100141,
122 GLU_TESS_TOLERANCE
= 100142,
124 /* Tessellation errors */
125 GLU_TESS_ERROR1
= 100151, /* Missing gluBeginPolygon */
126 GLU_TESS_ERROR2
= 100152, /* Missing gluBeginContour */
127 GLU_TESS_ERROR3
= 100153, /* Missing gluEndPolygon */
128 GLU_TESS_ERROR4
= 100154, /* Missing gluEndContour */
129 GLU_TESS_ERROR5
= 100155, /* */
130 GLU_TESS_ERROR6
= 100156, /* */
131 GLU_TESS_ERROR7
= 100157, /* */
132 GLU_TESS_ERROR8
= 100158, /* */
135 GLU_AUTO_LOAD_MATRIX
= 100200,
136 GLU_CULLING
= 100201,
137 GLU_PARAMETRIC_TOLERANCE
= 100202,
138 GLU_SAMPLING_TOLERANCE
= 100203,
139 GLU_DISPLAY_MODE
= 100204,
140 GLU_SAMPLING_METHOD
= 100205,
144 GLU_PATH_LENGTH
= 100215,
145 GLU_PARAMETRIC_ERROR
= 100216,
146 GLU_DOMAIN_DISTANCE
= 100217,
148 GLU_MAP1_TRIM_2
= 100210,
149 GLU_MAP1_TRIM_3
= 100211,
151 GLU_OUTLINE_POLYGON
= 100240,
152 GLU_OUTLINE_PATCH
= 100241,
154 GLU_NURBS_ERROR1
= 100251, /* spline order un-supported */
155 GLU_NURBS_ERROR2
= 100252, /* too few knots */
156 GLU_NURBS_ERROR3
= 100253, /* valid knot range is empty */
157 GLU_NURBS_ERROR4
= 100254, /* decreasing knot sequence */
158 GLU_NURBS_ERROR5
= 100255, /* knot multiplicity > spline order */
159 GLU_NURBS_ERROR6
= 100256, /* endcurve() must follow bgncurve() */
160 GLU_NURBS_ERROR7
= 100257, /* bgncurve() must precede endcurve() */
161 GLU_NURBS_ERROR8
= 100258, /* ctrlarray or knot vector is NULL */
162 GLU_NURBS_ERROR9
= 100259, /* can't draw pwlcurves */
163 GLU_NURBS_ERROR10
= 100260, /* missing gluNurbsCurve() */
164 GLU_NURBS_ERROR11
= 100261, /* missing gluNurbsSurface() */
165 GLU_NURBS_ERROR12
= 100262, /* endtrim() must precede endsurface() */
166 GLU_NURBS_ERROR13
= 100263, /* bgnsurface() must precede endsurface() */
167 GLU_NURBS_ERROR14
= 100264, /* curve of improper type passed as trim curve */
168 GLU_NURBS_ERROR15
= 100265, /* bgnsurface() must precede bgntrim() */
169 GLU_NURBS_ERROR16
= 100266, /* endtrim() must follow bgntrim() */
170 GLU_NURBS_ERROR17
= 100267, /* bgntrim() must precede endtrim()*/
171 GLU_NURBS_ERROR18
= 100268, /* invalid or missing trim curve*/
172 GLU_NURBS_ERROR19
= 100269, /* bgntrim() must precede pwlcurve() */
173 GLU_NURBS_ERROR20
= 100270, /* pwlcurve referenced twice*/
174 GLU_NURBS_ERROR21
= 100271, /* pwlcurve and nurbscurve mixed */
175 GLU_NURBS_ERROR22
= 100272, /* improper usage of trim data type */
176 GLU_NURBS_ERROR23
= 100273, /* nurbscurve referenced twice */
177 GLU_NURBS_ERROR24
= 100274, /* nurbscurve and pwlcurve mixed */
178 GLU_NURBS_ERROR25
= 100275, /* nurbssurface referenced twice */
179 GLU_NURBS_ERROR26
= 100276, /* invalid property */
180 GLU_NURBS_ERROR27
= 100277, /* endsurface() must follow bgnsurface() */
181 GLU_NURBS_ERROR28
= 100278, /* intersecting or misoriented trim curves */
182 GLU_NURBS_ERROR29
= 100279, /* intersecting trim curves */
183 GLU_NURBS_ERROR30
= 100280, /* UNUSED */
184 GLU_NURBS_ERROR31
= 100281, /* unconnected trim curves */
185 GLU_NURBS_ERROR32
= 100282, /* unknown knot error */
186 GLU_NURBS_ERROR33
= 100283, /* negative vertex count encountered */
187 GLU_NURBS_ERROR34
= 100284, /* negative byte-stride */
188 GLU_NURBS_ERROR35
= 100285, /* unknown type descriptor */
189 GLU_NURBS_ERROR36
= 100286, /* null control point reference */
190 GLU_NURBS_ERROR37
= 100287, /* duplicate point on pwlcurve */
193 GLU_INVALID_ENUM
= 100900,
194 GLU_INVALID_VALUE
= 100901,
195 GLU_OUT_OF_MEMORY
= 100902,
196 GLU_INCOMPATIBLE_GL_VERSION
= 100903,
199 GLU_VERSION
= 100800,
200 GLU_EXTENSIONS
= 100801,
202 /*** GLU 1.0 tessellation - obsolete! ***/
207 GLU_INTERIOR
= 100122,
208 GLU_EXTERIOR
= 100123,
209 GLU_UNKNOWN
= 100124,
212 GLU_BEGIN
= GLU_TESS_BEGIN
,
213 GLU_VERTEX
= GLU_TESS_VERTEX
,
214 GLU_END
= GLU_TESS_END
,
215 GLU_ERROR
= GLU_TESS_ERROR
,
216 GLU_EDGE_FLAG
= GLU_TESS_EDGE_FLAG
221 * These are the GLU 1.1 typedefs. GLU 1.3 has different ones!
223 #if defined(__BEOS__)
224 /* The BeOS does something funky and makes these typedefs in one
225 * of its system headers.
228 typedef struct GLUquadric GLUquadricObj
;
229 typedef struct GLUnurbs GLUnurbsObj
;
231 /* FIXME: We need to implement the other 1.3 typedefs - GH */
232 typedef struct GLUtesselator GLUtesselator
;
233 typedef GLUtesselator GLUtriangulatorObj
;
238 #if defined(__BEOS__) || defined(__QUICKDRAW__)
245 * Miscellaneous functions
249 GLUAPI
void GLAPIENTRY
gluLookAt( GLdouble eyex
, GLdouble eyey
, GLdouble eyez
,
250 GLdouble centerx
, GLdouble centery
,
252 GLdouble upx
, GLdouble upy
, GLdouble upz
);
255 GLUAPI
void GLAPIENTRY
gluOrtho2D( GLdouble left
, GLdouble right
,
256 GLdouble bottom
, GLdouble top
);
259 GLUAPI
void GLAPIENTRY
gluPerspective( GLdouble fovy
, GLdouble aspect
,
260 GLdouble zNear
, GLdouble zFar
);
263 GLUAPI
void GLAPIENTRY
gluPickMatrix( GLdouble x
, GLdouble y
,
264 GLdouble width
, GLdouble height
,
265 const GLint viewport
[4] );
267 GLUAPI GLint GLAPIENTRY
gluProject( GLdouble objx
, GLdouble objy
, GLdouble objz
,
268 const GLdouble modelMatrix
[16],
269 const GLdouble projMatrix
[16],
270 const GLint viewport
[4],
271 GLdouble
*winx
, GLdouble
*winy
,
274 GLUAPI GLint GLAPIENTRY
gluUnProject( GLdouble winx
, GLdouble winy
,
276 const GLdouble modelMatrix
[16],
277 const GLdouble projMatrix
[16],
278 const GLint viewport
[4],
279 GLdouble
*objx
, GLdouble
*objy
,
282 GLUAPI
const GLubyte
* GLAPIENTRY
gluErrorString( GLenum errorCode
);
288 * Mipmapping and image scaling
292 GLUAPI GLint GLAPIENTRY
gluScaleImage( GLenum format
,
293 GLint widthin
, GLint heightin
,
294 GLenum typein
, const void *datain
,
295 GLint widthout
, GLint heightout
,
296 GLenum typeout
, void *dataout
);
298 GLUAPI GLint GLAPIENTRY
gluBuild1DMipmaps( GLenum target
, GLint components
,
299 GLint width
, GLenum format
,
300 GLenum type
, const void *data
);
302 GLUAPI GLint GLAPIENTRY
gluBuild2DMipmaps( GLenum target
, GLint components
,
303 GLint width
, GLint height
,
305 GLenum type
, const void *data
);
315 GLUAPI GLUquadricObj
* GLAPIENTRY
gluNewQuadric( void );
317 GLUAPI
void GLAPIENTRY
gluDeleteQuadric( GLUquadricObj
*state
);
319 GLUAPI
void GLAPIENTRY
gluQuadricDrawStyle( GLUquadricObj
*quadObject
,
322 GLUAPI
void GLAPIENTRY
gluQuadricOrientation( GLUquadricObj
*quadObject
,
323 GLenum orientation
);
325 GLUAPI
void GLAPIENTRY
gluQuadricNormals( GLUquadricObj
*quadObject
,
328 GLUAPI
void GLAPIENTRY
gluQuadricTexture( GLUquadricObj
*quadObject
,
329 GLboolean textureCoords
);
331 GLUAPI
void GLAPIENTRY
gluQuadricCallback( GLUquadricObj
*qobj
,
332 GLenum which
, void (GLCALLBACK
*fn
)() );
334 GLUAPI
void GLAPIENTRY
gluCylinder( GLUquadricObj
*qobj
,
338 GLint slices
, GLint stacks
);
340 GLUAPI
void GLAPIENTRY
gluSphere( GLUquadricObj
*qobj
,
341 GLdouble radius
, GLint slices
, GLint stacks
);
343 GLUAPI
void GLAPIENTRY
gluDisk( GLUquadricObj
*qobj
,
344 GLdouble innerRadius
, GLdouble outerRadius
,
345 GLint slices
, GLint loops
);
347 GLUAPI
void GLAPIENTRY
gluPartialDisk( GLUquadricObj
*qobj
, GLdouble innerRadius
,
348 GLdouble outerRadius
, GLint slices
,
349 GLint loops
, GLdouble startAngle
,
350 GLdouble sweepAngle
);
360 GLUAPI GLUnurbsObj
* GLAPIENTRY
gluNewNurbsRenderer( void );
362 GLUAPI
void GLAPIENTRY
gluDeleteNurbsRenderer( GLUnurbsObj
*nobj
);
364 GLUAPI
void GLAPIENTRY
gluLoadSamplingMatrices( GLUnurbsObj
*nobj
,
365 const GLfloat modelMatrix
[16],
366 const GLfloat projMatrix
[16],
367 const GLint viewport
[4] );
369 GLUAPI
void GLAPIENTRY
gluNurbsProperty( GLUnurbsObj
*nobj
, GLenum property
,
372 GLUAPI
void GLAPIENTRY
gluGetNurbsProperty( GLUnurbsObj
*nobj
, GLenum property
,
375 GLUAPI
void GLAPIENTRY
gluBeginCurve( GLUnurbsObj
*nobj
);
377 GLUAPI
void GLAPIENTRY
gluEndCurve( GLUnurbsObj
* nobj
);
379 GLUAPI
void GLAPIENTRY
gluNurbsCurve( GLUnurbsObj
*nobj
, GLint nknots
,
380 GLfloat
*knot
, GLint stride
,
381 GLfloat
*ctlarray
, GLint order
,
384 GLUAPI
void GLAPIENTRY
gluBeginSurface( GLUnurbsObj
*nobj
);
386 GLUAPI
void GLAPIENTRY
gluEndSurface( GLUnurbsObj
* nobj
);
388 GLUAPI
void GLAPIENTRY
gluNurbsSurface( GLUnurbsObj
*nobj
,
389 GLint sknot_count
, GLfloat
*sknot
,
390 GLint tknot_count
, GLfloat
*tknot
,
391 GLint s_stride
, GLint t_stride
,
393 GLint sorder
, GLint torder
,
396 GLUAPI
void GLAPIENTRY
gluBeginTrim( GLUnurbsObj
*nobj
);
398 GLUAPI
void GLAPIENTRY
gluEndTrim( GLUnurbsObj
*nobj
);
400 GLUAPI
void GLAPIENTRY
gluPwlCurve( GLUnurbsObj
*nobj
, GLint count
,
401 GLfloat
*array
, GLint stride
, GLenum type
);
403 GLUAPI
void GLAPIENTRY
gluNurbsCallback( GLUnurbsObj
*nobj
, GLenum which
,
404 void (GLCALLBACK
*fn
)() );
410 * Polygon tessellation
414 GLUAPI GLUtesselator
* GLAPIENTRY
gluNewTess( void );
416 GLUAPI
void GLAPIENTRY
gluDeleteTess( GLUtesselator
*tobj
);
418 GLUAPI
void GLAPIENTRY
gluTessBeginPolygon( GLUtesselator
*tobj
,
419 void *polygon_data
);
421 GLUAPI
void GLAPIENTRY
gluTessBeginContour( GLUtesselator
*tobj
);
423 GLUAPI
void GLAPIENTRY
gluTessVertex( GLUtesselator
*tobj
, GLdouble coords
[3],
426 GLUAPI
void GLAPIENTRY
gluTessEndContour( GLUtesselator
*tobj
);
428 GLUAPI
void GLAPIENTRY
gluTessEndPolygon( GLUtesselator
*tobj
);
430 GLUAPI
void GLAPIENTRY
gluTessProperty( GLUtesselator
*tobj
, GLenum which
,
433 GLUAPI
void GLAPIENTRY
gluTessNormal( GLUtesselator
*tobj
, GLdouble x
,
434 GLdouble y
, GLdouble z
);
436 GLUAPI
void GLAPIENTRY
gluTessCallback( GLUtesselator
*tobj
, GLenum which
,
437 void (GLCALLBACK
*fn
)() );
439 GLUAPI
void GLAPIENTRY
gluGetTessProperty( GLUtesselator
*tobj
, GLenum which
,
444 * Obsolete 1.0 tessellation functions
448 GLUAPI
void GLAPIENTRY
gluBeginPolygon( GLUtesselator
*tobj
);
450 GLUAPI
void GLAPIENTRY
gluNextContour( GLUtesselator
*tobj
, GLenum type
);
452 GLUAPI
void GLAPIENTRY
gluEndPolygon( GLUtesselator
*tobj
);
458 * New functions in GLU 1.1
462 GLUAPI
const GLubyte
* GLAPIENTRY
gluGetString( GLenum name
);
467 * GLU_EXT_get_proc_address extension
470 * WARNING: this extension is not finalized yet! Do not release code
471 * which uses this extension yet! It may change!
473 #define GLU_EXT_get_proc_address 1
474 #ifdef GLU_EXT_get_proc_address
475 GLUAPI
void (GLAPIENTRY
*gluGetProcAddressEXT(const GLubyte
*procName
))();
479 #if defined(__BEOS__) || defined(__QUICKDRAW__)
485 #pragma enumsalwaysint reset
486 #if PRAGMA_IMPORT_SUPPORTED