1 /* $Id: glu.h,v 1.2 2000/11/01 22:18:00 mholst Exp $ */ 2 3 /* 4 * Mesa 3-D graphics library 5 * Version: 2.2 6 * Copyright (C) 1995-1997 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 #ifndef GLU_H 24 #define GLU_H 25 26 27 #if defined(USE_MGL_NAMESPACE) 28 #include "glu_mangle.h" 29 #endif 30 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 37 #include "GL/gl.h" 38 39 40 #define GLU_VERSION_1_1 1 41 42 43 #define GLU_TRUE GL_TRUE 44 #define GLU_FALSE GL_FALSE 45 46 47 enum { 48 /* Normal vectors */ 49 GLU_SMOOTH = 100000, 50 GLU_FLAT = 100001, 51 GLU_NONE = 100002, 52 53 /* Quadric draw styles */ 54 GLU_POINT = 100010, 55 GLU_LINE = 100011, 56 GLU_FILL = 100012, 57 GLU_SILHOUETTE = 100013, 58 59 /* Quadric orientation */ 60 GLU_OUTSIDE = 100020, 61 GLU_INSIDE = 100021, 62 63 /* Tesselator */ 64 GLU_BEGIN = 100100, 65 GLU_VERTEX = 100101, 66 GLU_END = 100102, 67 GLU_ERROR = 100103, 68 GLU_EDGE_FLAG = 100104, 69 70 /* Contour types */ 71 GLU_CW = 100120, 72 GLU_CCW = 100121, 73 GLU_INTERIOR = 100122, 74 GLU_EXTERIOR = 100123, 75 GLU_UNKNOWN = 100124, 76 77 /* Tesselation errors */ 78 GLU_TESS_ERROR1 = 100151, /* missing gluEndPolygon */ 79 GLU_TESS_ERROR2 = 100152, /* missing gluBeginPolygon */ 80 GLU_TESS_ERROR3 = 100153, /* misoriented contour */ 81 GLU_TESS_ERROR4 = 100154, /* vertex/edge intersection */ 82 GLU_TESS_ERROR5 = 100155, /* misoriented or self-intersecting loops */ 83 GLU_TESS_ERROR6 = 100156, /* coincident vertices */ 84 GLU_TESS_ERROR7 = 100157, /* all vertices collinear */ 85 GLU_TESS_ERROR8 = 100158, /* intersecting edges */ 86 GLU_TESS_ERROR9 = 100159, /* not coplanar contours */ 87 88 /* NURBS */ 89 GLU_AUTO_LOAD_MATRIX = 100200, 90 GLU_CULLING = 100201, 91 GLU_PARAMETRIC_TOLERANCE= 100202, 92 GLU_SAMPLING_TOLERANCE = 100203, 93 GLU_DISPLAY_MODE = 100204, 94 GLU_SAMPLING_METHOD = 100205, 95 GLU_U_STEP = 100206, 96 GLU_V_STEP = 100207, 97 98 GLU_PATH_LENGTH = 100215, 99 GLU_PARAMETRIC_ERROR = 100216, 100 GLU_DOMAIN_DISTANCE = 100217, 101 102 GLU_MAP1_TRIM_2 = 100210, 103 GLU_MAP1_TRIM_3 = 100211, 104 105 GLU_OUTLINE_POLYGON = 100240, 106 GLU_OUTLINE_PATCH = 100241, 107 108 GLU_NURBS_ERROR1 = 100251, /* spline order un-supported */ 109 GLU_NURBS_ERROR2 = 100252, /* too few knots */ 110 GLU_NURBS_ERROR3 = 100253, /* valid knot range is empty */ 111 GLU_NURBS_ERROR4 = 100254, /* decreasing knot sequence */ 112 GLU_NURBS_ERROR5 = 100255, /* knot multiplicity > spline order */ 113 GLU_NURBS_ERROR6 = 100256, /* endcurve() must follow bgncurve() */ 114 GLU_NURBS_ERROR7 = 100257, /* bgncurve() must precede endcurve() */ 115 GLU_NURBS_ERROR8 = 100258, /* ctrlarray or knot vector is NULL */ 116 GLU_NURBS_ERROR9 = 100259, /* can't draw pwlcurves */ 117 GLU_NURBS_ERROR10 = 100260, /* missing gluNurbsCurve() */ 118 GLU_NURBS_ERROR11 = 100261, /* missing gluNurbsSurface() */ 119 GLU_NURBS_ERROR12 = 100262, /* endtrim() must precede endsurface() */ 120 GLU_NURBS_ERROR13 = 100263, /* bgnsurface() must precede endsurface() */ 121 GLU_NURBS_ERROR14 = 100264, /* curve of improper type passed as trim curve */ 122 GLU_NURBS_ERROR15 = 100265, /* bgnsurface() must precede bgntrim() */ 123 GLU_NURBS_ERROR16 = 100266, /* endtrim() must follow bgntrim() */ 124 GLU_NURBS_ERROR17 = 100267, /* bgntrim() must precede endtrim()*/ 125 GLU_NURBS_ERROR18 = 100268, /* invalid or missing trim curve*/ 126 GLU_NURBS_ERROR19 = 100269, /* bgntrim() must precede pwlcurve() */ 127 GLU_NURBS_ERROR20 = 100270, /* pwlcurve referenced twice*/ 128 GLU_NURBS_ERROR21 = 100271, /* pwlcurve and nurbscurve mixed */ 129 GLU_NURBS_ERROR22 = 100272, /* improper usage of trim data type */ 130 GLU_NURBS_ERROR23 = 100273, /* nurbscurve referenced twice */ 131 GLU_NURBS_ERROR24 = 100274, /* nurbscurve and pwlcurve mixed */ 132 GLU_NURBS_ERROR25 = 100275, /* nurbssurface referenced twice */ 133 GLU_NURBS_ERROR26 = 100276, /* invalid property */ 134 GLU_NURBS_ERROR27 = 100277, /* endsurface() must follow bgnsurface() */ 135 GLU_NURBS_ERROR28 = 100278, /* intersecting or misoriented trim curves */ 136 GLU_NURBS_ERROR29 = 100279, /* intersecting trim curves */ 137 GLU_NURBS_ERROR30 = 100280, /* UNUSED */ 138 GLU_NURBS_ERROR31 = 100281, /* unconnected trim curves */ 139 GLU_NURBS_ERROR32 = 100282, /* unknown knot error */ 140 GLU_NURBS_ERROR33 = 100283, /* negative vertex count encountered */ 141 GLU_NURBS_ERROR34 = 100284, /* negative byte-stride */ 142 GLU_NURBS_ERROR35 = 100285, /* unknown type descriptor */ 143 GLU_NURBS_ERROR36 = 100286, /* null control point reference */ 144 GLU_NURBS_ERROR37 = 100287, /* duplicate point on pwlcurve */ 145 146 /* Errors */ 147 GLU_INVALID_ENUM = 100900, 148 GLU_INVALID_VALUE = 100901, 149 GLU_OUT_OF_MEMORY = 100902, 150 GLU_INCOMPATIBLE_GL_VERSION = 100903, 151 152 /* New in GLU 1.1 */ 153 GLU_VERSION = 100800, 154 GLU_EXTENSIONS = 100801 155 }; 156 157 158 typedef struct GLUquadricObj GLUquadricObj; 159 160 typedef struct GLUtriangulatorObj GLUtriangulatorObj; 161 162 typedef struct GLUnurbsObj GLUnurbsObj; 163 164 165 166 #if defined(__BEOS__) || defined(__QUICKDRAW__) 167 #pragma export on 168 #endif 169 170 171 /* 172 * 173 * Miscellaneous functions 174 * 175 */ 176 177 extern void gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez, 178 GLdouble centerx, GLdouble centery, GLdouble centerz, 179 GLdouble upx, GLdouble upy, GLdouble upz ); 180 181 182 extern void gluOrtho2D( GLdouble left, GLdouble right, 183 GLdouble bottom, GLdouble top ); 184 185 186 extern void gluPerspective( GLdouble fovy, GLdouble aspect, 187 GLdouble zNear, GLdouble zFar ); 188 189 190 extern void gluPickMatrix( GLdouble x, GLdouble y, 191 GLdouble width, GLdouble height, 192 GLint viewport[4] ); 193 194 extern GLint gluProject( GLdouble objx, GLdouble objy, GLdouble objz, 195 const GLdouble modelMatrix[16], 196 const GLdouble projMatrix[16], 197 const GLint viewport[4], 198 GLdouble *winx, GLdouble *winy, GLdouble *winz ); 199 200 extern GLint gluUnProject( GLdouble winx, GLdouble winy, GLdouble winz, 201 const GLdouble modelMatrix[16], 202 const GLdouble projMatrix[16], 203 const GLint viewport[4], 204 GLdouble *objx, GLdouble *objy, GLdouble *objz ); 205 206 extern const GLubyte* gluErrorString( GLenum errorCode ); 207 208 209 210 /* 211 * 212 * Mipmapping and image scaling 213 * 214 */ 215 216 extern GLint gluScaleImage( GLenum format, 217 GLint widthin, GLint heightin, 218 GLenum typein, const void *datain, 219 GLint widthout, GLint heightout, 220 GLenum typeout, void *dataout ); 221 222 extern GLint gluBuild1DMipmaps( GLenum target, GLint components, 223 GLint width, GLenum format, 224 GLenum type, const void *data ); 225 226 extern GLint gluBuild2DMipmaps( GLenum target, GLint components, 227 GLint width, GLint height, GLenum format, 228 GLenum type, const void *data ); 229 230 231 232 /* 233 * 234 * Quadrics 235 * 236 */ 237 238 extern GLUquadricObj *gluNewQuadric( void ); 239 240 extern void gluDeleteQuadric( GLUquadricObj *state ); 241 242 extern void gluQuadricDrawStyle( GLUquadricObj *quadObject, 243 GLenum drawStyle ); 244 245 extern void gluQuadricOrientation( GLUquadricObj *quadObject, 246 GLenum orientation ); 247 248 extern void gluQuadricNormals( GLUquadricObj *quadObject, GLenum normals ); 249 250 extern void gluQuadricTexture( GLUquadricObj *quadObject, 251 GLboolean textureCoords ); 252 253 extern void gluQuadricCallback( GLUquadricObj *qobj, 254 GLenum which, void (*fn)(GLenum) ); 255 256 extern void gluCylinder( GLUquadricObj *qobj, 257 GLdouble baseRadius, 258 GLdouble topRadius, 259 GLdouble height, 260 GLint slices, GLint stacks ); 261 262 extern void gluSphere( GLUquadricObj *qobj, 263 GLdouble radius, GLint slices, GLint stacks ); 264 265 extern void gluDisk( GLUquadricObj *qobj, 266 GLdouble innerRadius, GLdouble outerRadius, 267 GLint slices, GLint loops ); 268 269 extern void gluPartialDisk( GLUquadricObj *qobj, GLdouble innerRadius, 270 GLdouble outerRadius, GLint slices, GLint loops, 271 GLdouble startAngle, GLdouble sweepAngle ); 272 273 274 275 /* 276 * 277 * Nurbs 278 * 279 */ 280 281 extern GLUnurbsObj *gluNewNurbsRenderer( void ); 282 283 extern void gluDeleteNurbsRenderer( GLUnurbsObj *nobj ); 284 285 extern void gluLoadSamplingMatrices( GLUnurbsObj *nobj, 286 const GLfloat modelMatrix[16], 287 const GLfloat projMatrix[16], 288 const GLint viewport[4] ); 289 290 extern void gluNurbsProperty( GLUnurbsObj *nobj, GLenum property, 291 GLfloat value ); 292 293 extern void gluGetNurbsProperty( GLUnurbsObj *nobj, GLenum property, 294 GLfloat *value ); 295 296 extern void gluBeginCurve( GLUnurbsObj *nobj ); 297 298 extern void gluEndCurve( GLUnurbsObj * nobj ); 299 300 extern void gluNurbsCurve( GLUnurbsObj *nobj, GLint nknots, GLfloat *knot, 301 GLint stride, GLfloat *ctlarray, GLint order, 302 GLenum type ); 303 304 extern void gluBeginSurface( GLUnurbsObj *nobj ); 305 306 extern void gluEndSurface( GLUnurbsObj * nobj ); 307 308 extern void gluNurbsSurface( GLUnurbsObj *nobj, 309 GLint sknot_count, GLfloat *sknot, 310 GLint tknot_count, GLfloat *tknot, 311 GLint s_stride, GLint t_stride, 312 GLfloat *ctlarray, 313 GLint sorder, GLint torder, 314 GLenum type ); 315 316 extern void gluBeginTrim( GLUnurbsObj *nobj ); 317 318 extern void gluEndTrim( GLUnurbsObj *nobj ); 319 320 extern void gluPwlCurve( GLUnurbsObj *nobj, GLint count, GLfloat *array, 321 GLint stride, GLenum type ); 322 323 extern void gluNurbsCallback( GLUnurbsObj *nobj, GLenum which, 324 void (*fn)(GLenum) ); 325 326 327 328 /* 329 * 330 * Polygon tesselation 331 * 332 */ 333 334 extern GLUtriangulatorObj* gluNewTess( void ); 335 336 extern void gluTessCallback( GLUtriangulatorObj *tobj, GLenum which, 337 void (*fn)(GLenum) ); 338 339 extern void gluDeleteTess( GLUtriangulatorObj *tobj ); 340 341 extern void gluBeginPolygon( GLUtriangulatorObj *tobj ); 342 343 extern void gluEndPolygon( GLUtriangulatorObj *tobj ); 344 345 extern void gluNextContour( GLUtriangulatorObj *tobj, GLenum type ); 346 347 extern void gluTessVertex( GLUtriangulatorObj *tobj, GLdouble v[3], 348 void *data ); 349 350 351 352 /* 353 * 354 * New functions in GLU 1.1 355 * 356 */ 357 358 extern const GLubyte* gluGetString( GLenum name ); 359 360 361 #if defined(__BEOS__) || defined(__QUICKDRAW__) 362 #pragma export off 363 #endif 364 365 366 #ifdef __cplusplus 367 } 368 #endif 369 370 371 #endif 372