home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / mesa-1.2.8 / include / gl / glu.h < prev    next >
C/C++ Source or Header  |  1996-05-27  |  12KB  |  414 lines

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