Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

glu.h 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. /* $Id: glu.h,v 1.22 2000/07/11 14:11:44 brianp Exp $ */
  2. /*
  3. * Mesa 3-D graphics library
  4. * Version: 3.3
  5. * Copyright (C) 1995-2000 Brian Paul
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Library General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public
  18. * License along with this library; if not, write to the Free
  19. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. */
  21. #ifndef GLU_H
  22. #define GLU_H
  23. #if defined(USE_MGL_NAMESPACE)
  24. #include "glu_mangle.h"
  25. #endif
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. #include <GL/gl.h>
  30. /* to facilitate clean DLL building ... */
  31. #if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN__))
  32. # if defined(_MSC_VER) && defined(BUILD_GLU32) /* tag specify we're building mesa as a DLL */
  33. # define GLUAPI __declspec(dllexport)
  34. # elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
  35. # define GLUAPI __declspec(dllimport)
  36. # else /* for use with static link lib build of Win32 edition only */
  37. # define GLUAPI extern
  38. # endif /* _STATIC_MESA support */
  39. # define GLCALLBACK __stdcall
  40. # define GLCALLBACKP __stdcall *
  41. #else
  42. # define GLUAPI extern
  43. # define GLCALLBACK
  44. # define GLCALLBACKP *
  45. #endif /* WIN32 / CYGWIN bracket */
  46. /* compatability guard so we don't need to change client code */
  47. #if defined(_WIN32) && !defined(_WINDEF_) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP)
  48. # define CALLBACK GLCALLBACK
  49. #endif
  50. #ifdef macintosh
  51. #pragma enumsalwaysint on
  52. #if PRAGMA_IMPORT_SUPPORTED
  53. #pragma import on
  54. #endif
  55. #endif
  56. #ifndef GLUAPI
  57. #define GLUAPI
  58. #endif
  59. #ifndef GLAPIENTRY
  60. #define GLAPIENTRY
  61. #endif
  62. #ifndef GLCALLBACK
  63. #define GLCALLBACK
  64. #endif
  65. #define GLU_VERSION_1_1 1
  66. #define GLU_TRUE 1
  67. #define GLU_FALSE 0
  68. /* Normal vectors */
  69. #define GLU_SMOOTH 100000
  70. #define GLU_FLAT 100001
  71. #define GLU_NONE 100002
  72. /* Quadric draw styles */
  73. #define GLU_POINT 100010
  74. #define GLU_LINE 100011
  75. #define GLU_FILL 100012
  76. #define GLU_SILHOUETTE 100013
  77. /* Quadric orientation */
  78. #define GLU_OUTSIDE 100020
  79. #define GLU_INSIDE 100021
  80. /* Tessellator */
  81. #define GLU_TESS_BEGIN 100100
  82. #define GLU_TESS_VERTEX 100101
  83. #define GLU_TESS_END 100102
  84. #define GLU_TESS_ERROR 100103
  85. #define GLU_TESS_EDGE_FLAG 100104
  86. #define GLU_TESS_COMBINE 100105
  87. #define GLU_TESS_BEGIN_DATA 100106
  88. #define GLU_TESS_VERTEX_DATA 100107
  89. #define GLU_TESS_END_DATA 100108
  90. #define GLU_TESS_ERROR_DATA 100109
  91. #define GLU_TESS_EDGE_FLAG_DATA 100110
  92. #define GLU_TESS_COMBINE_DATA 100111
  93. /* Winding rules */
  94. #define GLU_TESS_WINDING_ODD 100130
  95. #define GLU_TESS_WINDING_NONZERO 100131
  96. #define GLU_TESS_WINDING_POSITIVE 100132
  97. #define GLU_TESS_WINDING_NEGATIVE 100133
  98. #define GLU_TESS_WINDING_ABS_GEQ_TWO 100134
  99. /* Tessellation properties */
  100. #define GLU_TESS_WINDING_RULE 100140
  101. #define GLU_TESS_BOUNDARY_ONLY 100141
  102. #define GLU_TESS_TOLERANCE 100142
  103. /* Tessellation errors */
  104. #define GLU_TESS_ERROR1 100151 /* Missing gluBeginPolygon */
  105. #define GLU_TESS_ERROR2 100152 /* Missing gluBeginContour */
  106. #define GLU_TESS_ERROR3 100153 /* Missing gluEndPolygon */
  107. #define GLU_TESS_ERROR4 100154 /* Missing gluEndContour */
  108. #define GLU_TESS_ERROR5 100155 /* */
  109. #define GLU_TESS_ERROR6 100156 /* */
  110. #define GLU_TESS_ERROR7 100157 /* */
  111. #define GLU_TESS_ERROR8 100158 /* */
  112. /* NURBS */
  113. #define GLU_AUTO_LOAD_MATRIX 100200
  114. #define GLU_CULLING 100201
  115. #define GLU_PARAMETRIC_TOLERANCE 100202
  116. #define GLU_SAMPLING_TOLERANCE 100203
  117. #define GLU_DISPLAY_MODE 100204
  118. #define GLU_SAMPLING_METHOD 100205
  119. #define GLU_U_STEP 100206
  120. #define GLU_V_STEP 100207
  121. #define GLU_PATH_LENGTH 100215
  122. #define GLU_PARAMETRIC_ERROR 100216
  123. #define GLU_DOMAIN_DISTANCE 100217
  124. #define GLU_MAP1_TRIM_2 100210
  125. #define GLU_MAP1_TRIM_3 100211
  126. #define GLU_OUTLINE_POLYGON 100240
  127. #define GLU_OUTLINE_PATCH 100241
  128. #define GLU_NURBS_ERROR1 100251 /* spline order un-supported */
  129. #define GLU_NURBS_ERROR2 100252 /* too few knots */
  130. #define GLU_NURBS_ERROR3 100253 /* valid knot range is empty */
  131. #define GLU_NURBS_ERROR4 100254 /* decreasing knot sequence */
  132. #define GLU_NURBS_ERROR5 100255 /* knot multiplicity > spline order */
  133. #define GLU_NURBS_ERROR6 100256 /* endcurve() must follow bgncurve() */
  134. #define GLU_NURBS_ERROR7 100257 /* bgncurve() must precede endcurve() */
  135. #define GLU_NURBS_ERROR8 100258 /* ctrlarray or knot vector is NULL */
  136. #define GLU_NURBS_ERROR9 100259 /* can't draw pwlcurves */
  137. #define GLU_NURBS_ERROR10 100260 /* missing gluNurbsCurve() */
  138. #define GLU_NURBS_ERROR11 100261 /* missing gluNurbsSurface() */
  139. #define GLU_NURBS_ERROR12 100262 /* endtrim() must precede endsurface() */
  140. #define GLU_NURBS_ERROR13 100263 /* bgnsurface() must precede endsurface() */
  141. #define GLU_NURBS_ERROR14 100264 /* curve of improper type passed as trim curve */
  142. #define GLU_NURBS_ERROR15 100265 /* bgnsurface() must precede bgntrim() */
  143. #define GLU_NURBS_ERROR16 100266 /* endtrim() must follow bgntrim() */
  144. #define GLU_NURBS_ERROR17 100267 /* bgntrim() must precede endtrim()*/
  145. #define GLU_NURBS_ERROR18 100268 /* invalid or missing trim curve*/
  146. #define GLU_NURBS_ERROR19 100269 /* bgntrim() must precede pwlcurve() */
  147. #define GLU_NURBS_ERROR20 100270 /* pwlcurve referenced twice*/
  148. #define GLU_NURBS_ERROR21 100271 /* pwlcurve and nurbscurve mixed */
  149. #define GLU_NURBS_ERROR22 100272 /* improper usage of trim data type */
  150. #define GLU_NURBS_ERROR23 100273 /* nurbscurve referenced twice */
  151. #define GLU_NURBS_ERROR24 100274 /* nurbscurve and pwlcurve mixed */
  152. #define GLU_NURBS_ERROR25 100275 /* nurbssurface referenced twice */
  153. #define GLU_NURBS_ERROR26 100276 /* invalid property */
  154. #define GLU_NURBS_ERROR27 100277 /* endsurface() must follow bgnsurface() */
  155. #define GLU_NURBS_ERROR28 100278 /* intersecting or misoriented trim curves */
  156. #define GLU_NURBS_ERROR29 100279 /* intersecting trim curves */
  157. #define GLU_NURBS_ERROR30 100280 /* UNUSED */
  158. #define GLU_NURBS_ERROR31 100281 /* unconnected trim curves */
  159. #define GLU_NURBS_ERROR32 100282 /* unknown knot error */
  160. #define GLU_NURBS_ERROR33 100283 /* negative vertex count encountered */
  161. #define GLU_NURBS_ERROR34 100284 /* negative byte-stride */
  162. #define GLU_NURBS_ERROR35 100285 /* unknown type descriptor */
  163. #define GLU_NURBS_ERROR36 100286 /* null control point reference */
  164. #define GLU_NURBS_ERROR37 100287 /* duplicate point on pwlcurve */
  165. /* GLU 1.3 and later */
  166. #define GLU_NURBS_MODE ?
  167. /* Errors */
  168. #define GLU_INVALID_ENUM 100900
  169. #define GLU_INVALID_VALUE 100901
  170. #define GLU_OUT_OF_MEMORY 100902
  171. #define GLU_INCOMPATIBLE_GL_VERSION 100903
  172. /* GLU 1.1 and later */
  173. #define GLU_VERSION 100800
  174. #define GLU_EXTENSIONS 100801
  175. /*** GLU 1.0 tessellation ***/
  176. /* Contour types */
  177. #define GLU_CW 100120
  178. #define GLU_CCW 100121
  179. #define GLU_INTERIOR 100122
  180. #define GLU_EXTERIOR 100123
  181. #define GLU_UNKNOWN 100124
  182. /* Tessellator */
  183. #define GLU_BEGIN GLU_TESS_BEGIN
  184. #define GLU_VERTEX GLU_TESS_VERTEX
  185. #define GLU_END GLU_TESS_END
  186. #define GLU_ERROR GLU_TESS_ERROR
  187. #define GLU_EDGE_FLAG GLU_TESS_EDGE_FLAG
  188. #if defined(__BEOS__)
  189. /* The BeOS does something funky and makes these typedefs in one
  190. * of its system headers.
  191. */
  192. #else
  193. #if defined GLU_VERSION_1_2
  194. typedef struct GLUquadric GLUquadricObj;
  195. typedef struct GLUnurbs GLUnurbsObj;
  196. /* FIXME: We need to implement the other 1.3 typedefs - GH */
  197. typedef struct GLUtesselator GLUtesselator;
  198. typedef GLUtesselator GLUtriangulatorObj;
  199. #else
  200. /* GLU 1.1 and older */
  201. typedef struct GLUquadric GLUquadricObj;
  202. typedef struct GLUtriangulatorObj GLUtriangulatorObj;
  203. typedef struct GLUnurbs GLUnurbsObj;
  204. #endif
  205. #endif
  206. #if defined(__BEOS__) || defined(__QUICKDRAW__)
  207. #pragma export on
  208. #endif
  209. /*
  210. *
  211. * Miscellaneous functions
  212. *
  213. */
  214. GLUAPI void GLAPIENTRY gluLookAt( GLdouble eyex, GLdouble eyey, GLdouble eyez,
  215. GLdouble centerx, GLdouble centery,
  216. GLdouble centerz,
  217. GLdouble upx, GLdouble upy, GLdouble upz );
  218. GLUAPI void GLAPIENTRY gluOrtho2D( GLdouble left, GLdouble right,
  219. GLdouble bottom, GLdouble top );
  220. GLUAPI void GLAPIENTRY gluPerspective( GLdouble fovy, GLdouble aspect,
  221. GLdouble zNear, GLdouble zFar );
  222. GLUAPI void GLAPIENTRY gluPickMatrix( GLdouble x, GLdouble y,
  223. GLdouble width, GLdouble height,
  224. const GLint viewport[4] );
  225. GLUAPI GLint GLAPIENTRY gluProject( GLdouble objx, GLdouble objy, GLdouble objz,
  226. const GLdouble modelMatrix[16],
  227. const GLdouble projMatrix[16],
  228. const GLint viewport[4],
  229. GLdouble *winx, GLdouble *winy,
  230. GLdouble *winz );
  231. GLUAPI GLint GLAPIENTRY gluUnProject( GLdouble winx, GLdouble winy,
  232. GLdouble winz,
  233. const GLdouble modelMatrix[16],
  234. const GLdouble projMatrix[16],
  235. const GLint viewport[4],
  236. GLdouble *objx, GLdouble *objy,
  237. GLdouble *objz );
  238. GLUAPI const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode );
  239. /*
  240. *
  241. * Mipmapping and image scaling
  242. *
  243. */
  244. GLUAPI GLint GLAPIENTRY gluScaleImage( GLenum format,
  245. GLsizei widthin, GLsizei heightin,
  246. GLenum typein, const void *datain,
  247. GLsizei widthout, GLsizei heightout,
  248. GLenum typeout, void *dataout );
  249. GLUAPI GLint GLAPIENTRY gluBuild1DMipmaps( GLenum target, GLint components,
  250. GLsizei width, GLenum format,
  251. GLenum type, const void *data );
  252. GLUAPI GLint GLAPIENTRY gluBuild2DMipmaps( GLenum target, GLint components,
  253. GLsizei width, GLsizei height,
  254. GLenum format,
  255. GLenum type, const void *data );
  256. /*
  257. *
  258. * Quadrics
  259. *
  260. */
  261. GLUAPI GLUquadricObj* GLAPIENTRY gluNewQuadric( void );
  262. GLUAPI void GLAPIENTRY gluDeleteQuadric( GLUquadricObj *state );
  263. GLUAPI void GLAPIENTRY gluQuadricDrawStyle( GLUquadricObj *quadObject,
  264. GLenum drawStyle );
  265. GLUAPI void GLAPIENTRY gluQuadricOrientation( GLUquadricObj *quadObject,
  266. GLenum orientation );
  267. GLUAPI void GLAPIENTRY gluQuadricNormals( GLUquadricObj *quadObject,
  268. GLenum normals );
  269. GLUAPI void GLAPIENTRY gluQuadricTexture( GLUquadricObj *quadObject,
  270. GLboolean textureCoords );
  271. GLUAPI void GLAPIENTRY gluQuadricCallback( GLUquadricObj *qobj,
  272. GLenum which,
  273. void (GLCALLBACK *fn)() );
  274. GLUAPI void GLAPIENTRY gluCylinder( GLUquadricObj *qobj,
  275. GLdouble baseRadius,
  276. GLdouble topRadius,
  277. GLdouble height,
  278. GLint slices, GLint stacks );
  279. GLUAPI void GLAPIENTRY gluSphere( GLUquadricObj *qobj,
  280. GLdouble radius,
  281. GLint slices, GLint stacks );
  282. GLUAPI void GLAPIENTRY gluDisk( GLUquadricObj *qobj,
  283. GLdouble innerRadius, GLdouble outerRadius,
  284. GLint slices, GLint loops );
  285. GLUAPI void GLAPIENTRY gluPartialDisk( GLUquadricObj *qobj,
  286. GLdouble innerRadius,
  287. GLdouble outerRadius, GLint slices,
  288. GLint loops, GLdouble startAngle,
  289. GLdouble sweepAngle );
  290. /*
  291. *
  292. * Nurbs
  293. *
  294. */
  295. GLUAPI GLUnurbsObj* GLAPIENTRY gluNewNurbsRenderer( void );
  296. GLUAPI void GLAPIENTRY gluDeleteNurbsRenderer( GLUnurbsObj *nobj );
  297. GLUAPI void GLAPIENTRY gluLoadSamplingMatrices( GLUnurbsObj *nobj,
  298. const GLfloat modelMatrix[16],
  299. const GLfloat projMatrix[16],
  300. const GLint viewport[4] );
  301. GLUAPI void GLAPIENTRY gluNurbsProperty( GLUnurbsObj *nobj, GLenum property,
  302. GLfloat value );
  303. GLUAPI void GLAPIENTRY gluGetNurbsProperty( GLUnurbsObj *nobj, GLenum property,
  304. GLfloat *value );
  305. GLUAPI void GLAPIENTRY gluBeginCurve( GLUnurbsObj *nobj );
  306. GLUAPI void GLAPIENTRY gluEndCurve( GLUnurbsObj * nobj );
  307. GLUAPI void GLAPIENTRY gluNurbsCurve( GLUnurbsObj *nobj, GLint nknots,
  308. GLfloat *knot, GLint stride,
  309. GLfloat *ctlarray, GLint order,
  310. GLenum type );
  311. GLUAPI void GLAPIENTRY gluBeginSurface( GLUnurbsObj *nobj );
  312. GLUAPI void GLAPIENTRY gluEndSurface( GLUnurbsObj * nobj );
  313. GLUAPI void GLAPIENTRY gluNurbsSurface( GLUnurbsObj *nobj,
  314. GLint sknot_count, GLfloat *sknot,
  315. GLint tknot_count, GLfloat *tknot,
  316. GLint s_stride, GLint t_stride,
  317. GLfloat *ctlarray,
  318. GLint sorder, GLint torder,
  319. GLenum type );
  320. GLUAPI void GLAPIENTRY gluBeginTrim( GLUnurbsObj *nobj );
  321. GLUAPI void GLAPIENTRY gluEndTrim( GLUnurbsObj *nobj );
  322. GLUAPI void GLAPIENTRY gluPwlCurve( GLUnurbsObj *nobj, GLint count,
  323. GLfloat *array,
  324. GLint stride, GLenum type );
  325. GLUAPI void GLAPIENTRY gluNurbsCallback( GLUnurbsObj *nobj, GLenum which,
  326. void (GLCALLBACK *fn)() );
  327. /*
  328. *
  329. * Polygon tessellation
  330. *
  331. */
  332. #ifdef GLU_VERSION_1_2
  333. GLUAPI GLUtesselator* GLAPIENTRY gluNewTess( void );
  334. GLUAPI void GLAPIENTRY gluDeleteTess( GLUtesselator *tobj );
  335. GLUAPI void GLAPIENTRY gluTessBeginPolygon( GLUtesselator *tobj,
  336. void *polygon_data );
  337. GLUAPI void GLAPIENTRY gluTessBeginContour( GLUtesselator *tobj );
  338. GLUAPI void GLAPIENTRY gluTessVertex( GLUtesselator *tobj, GLdouble coords[3],
  339. void *vertex_data );
  340. GLUAPI void GLAPIENTRY gluTessEndContour( GLUtesselator *tobj );
  341. GLUAPI void GLAPIENTRY gluTessEndPolygon( GLUtesselator *tobj );
  342. GLUAPI void GLAPIENTRY gluTessProperty( GLUtesselator *tobj, GLenum which,
  343. GLdouble value );
  344. GLUAPI void GLAPIENTRY gluTessNormal( GLUtesselator *tobj, GLdouble x,
  345. GLdouble y, GLdouble z );
  346. GLUAPI void GLAPIENTRY gluTessCallback( GLUtesselator *tobj, GLenum which,
  347. void (GLCALLBACK *fn)() );
  348. GLUAPI void GLAPIENTRY gluGetTessProperty( GLUtesselator *tobj, GLenum which,
  349. GLdouble *value );
  350. #else
  351. GLUAPI GLUtriangulatorObj* GLAPIENTRY gluNewTess( void );
  352. GLUAPI void GLAPIENTRY gluTessCallback( GLUtriangulatorObj *tobj, GLenum which,
  353. void (GLCALLBACK *fn)() );
  354. GLUAPI void GLAPIENTRY gluDeleteTess( GLUtriangulatorObj *tobj );
  355. GLUAPI void GLAPIENTRY gluBeginPolygon( GLUtriangulatorObj *tobj );
  356. GLUAPI void GLAPIENTRY gluEndPolygon( GLUtriangulatorObj *tobj );
  357. GLUAPI void GLAPIENTRY gluNextContour( GLUtriangulatorObj *tobj, GLenum type );
  358. GLUAPI void GLAPIENTRY gluTessVertex( GLUtriangulatorObj *tobj, GLdouble v[3],
  359. void *data );
  360. #endif
  361. /*
  362. *
  363. * New functions in GLU 1.1
  364. *
  365. */
  366. GLUAPI const GLubyte* GLAPIENTRY gluGetString( GLenum name );
  367. /*
  368. *
  369. * GLU 1.3 functions
  370. *
  371. */
  372. #ifdef GLU_VERSION_1_3
  373. GLUAPI GLboolean GLAPIENTRY
  374. gluCheckExtension( const char *extName, const GLubyte *extString );
  375. #endif
  376. #if defined(__BEOS__) || defined(__QUICKDRAW__)
  377. #pragma export off
  378. #endif
  379. #ifdef macintosh
  380. #pragma enumsalwaysint reset
  381. #if PRAGMA_IMPORT_SUPPORTED
  382. #pragma import off
  383. #endif
  384. #endif
  385. #ifdef __cplusplus
  386. }
  387. #endif
  388. #endif