glu_sl.pp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. {
  2. $Id$
  3. Translation of the Mesa GLU headers for FreePascal
  4. Copyright (C) 1999 Sebastian Guenther
  5. Version for static linking in Win32 environment.
  6. Latest change: 1999-11-11
  7. Original copyright notice:
  8. Mesa 3-D graphics library
  9. Version: 3.0
  10. Copyright (C) 1995-1998 Brian Paul
  11. This library is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU Library General Public
  13. License as published by the Free Software Foundation; either
  14. version 2 of the License, or (at your option) any later version.
  15. This library is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. Library General Public License for more details.
  19. You should have received a copy of the GNU Library General Public
  20. License along with this library; if not, write to the Free
  21. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. }
  23. {$MODE delphi} // objfpc would not work because of direct proc var assignments
  24. {You have to enable Macros (compiler switch "-Sm") for compiling this unit!
  25. This is necessary for supporting different platforms with different calling
  26. conventions via a single unit.}
  27. unit GLU; // version with static linking
  28. interface
  29. {$MACRO ON}
  30. {$IFDEF Win32}
  31. {$DEFINE glu_dll := external 'glu32.dll'}
  32. uses
  33. Windows,
  34. GL; { for definition of GL_TRUE/FALS }
  35. {$ELSE}
  36. {$MESSAGE Unsupported platform.}
  37. {$ENDIF}
  38. // =======================================================
  39. // Unit specific extensions
  40. // =======================================================
  41. // none - no special init required
  42. // =======================================================
  43. // GLU consts, types and functions
  44. // =======================================================
  45. const
  46. GLU_TRUE = GL_TRUE;
  47. GLU_FALSE = GL_FALSE;
  48. // Normal vectors
  49. GLU_SMOOTH = 100000;
  50. GLU_FLAT = 100001;
  51. GLU_NONE = 100002;
  52. // Quadric draw styles
  53. GLU_POINT = 100010;
  54. GLU_LINE = 100011;
  55. GLU_FILL = 100012;
  56. GLU_SILHOUETTE = 100013;
  57. // Quadric orientation
  58. GLU_OUTSIDE = 100020;
  59. GLU_INSIDE = 100021;
  60. // Tesselator
  61. GLU_BEGIN = 100100;
  62. GLU_VERTEX = 100101;
  63. GLU_END = 100102;
  64. GLU_ERROR = 100103;
  65. GLU_EDGE_FLAG = 100104;
  66. // Contour types
  67. GLU_CW = 100120;
  68. GLU_CCW = 100121;
  69. GLU_INTERIOR = 100122;
  70. GLU_EXTERIOR = 100123;
  71. GLU_UNKNOWN = 100124;
  72. // Tesselation errors
  73. GLU_TESS_ERROR1 = 100151; // missing gluEndPolygon
  74. GLU_TESS_ERROR2 = 100152; // missing gluBeginPolygon
  75. GLU_TESS_ERROR3 = 100153; // misoriented contour
  76. GLU_TESS_ERROR4 = 100154; // vertex/edge intersection
  77. GLU_TESS_ERROR5 = 100155; // misoriented or self-intersecting loops
  78. GLU_TESS_ERROR6 = 100156; // coincident vertices
  79. GLU_TESS_ERROR7 = 100157; // all vertices collinear
  80. GLU_TESS_ERROR8 = 100158; // intersecting edges
  81. GLU_TESS_ERROR9 = 100159; // not coplanar contours
  82. // NURBS
  83. GLU_AUTO_LOAD_MATRIX = 100200;
  84. GLU_CULLING = 100201;
  85. GLU_PARAMETRIC_TOLERANCE = 100202;
  86. GLU_SAMPLING_TOLERANCE = 100203;
  87. GLU_DISPLAY_MODE = 100204;
  88. GLU_SAMPLING_METHOD = 100205;
  89. GLU_U_STEP = 100206;
  90. GLU_V_STEP = 100207;
  91. GLU_PATH_LENGTH = 100215;
  92. GLU_PARAMETRIC_ERROR = 100216;
  93. GLU_DOMAIN_DISTANCE = 100217;
  94. GLU_MAP1_TRIM_2 = 100210;
  95. GLU_MAP1_TRIM_3 = 100211;
  96. GLU_OUTLINE_POLYGON = 100240;
  97. GLU_OUTLINE_PATCH = 100241;
  98. GLU_NURBS_ERROR1 = 100251; // spline order un-supported
  99. GLU_NURBS_ERROR2 = 100252; // too few knots
  100. GLU_NURBS_ERROR3 = 100253; // valid knot range is empty
  101. GLU_NURBS_ERROR4 = 100254; // decreasing knot sequence
  102. GLU_NURBS_ERROR5 = 100255; // knot multiplicity > spline order
  103. GLU_NURBS_ERROR6 = 100256; // endcurve() must follow bgncurve()
  104. GLU_NURBS_ERROR7 = 100257; // bgncurve() must precede endcurve()
  105. GLU_NURBS_ERROR8 = 100258; // ctrlarray or knot vector is NULL
  106. GLU_NURBS_ERROR9 = 100259; // cannot draw pwlcurves
  107. GLU_NURBS_ERROR10 = 100260; // missing gluNurbsCurve()
  108. GLU_NURBS_ERROR11 = 100261; // missing gluNurbsSurface()
  109. GLU_NURBS_ERROR12 = 100262; // endtrim() must precede endsurface()
  110. GLU_NURBS_ERROR13 = 100263; // bgnsurface() must precede endsurface()
  111. GLU_NURBS_ERROR14 = 100264; // curve of improper type passed as trim curve
  112. GLU_NURBS_ERROR15 = 100265; // bgnsurface() must precede bgntrim()
  113. GLU_NURBS_ERROR16 = 100266; // endtrim() must follow bgntrim()
  114. GLU_NURBS_ERROR17 = 100267; // bgntrim() must precede endtrim()*/
  115. GLU_NURBS_ERROR18 = 100268; // invalid or missing trim curve*/
  116. GLU_NURBS_ERROR19 = 100269; // bgntrim() must precede pwlcurve()
  117. GLU_NURBS_ERROR20 = 100270; // pwlcurve referenced twice*/
  118. GLU_NURBS_ERROR21 = 100271; // pwlcurve and nurbscurve mixed
  119. GLU_NURBS_ERROR22 = 100272; // improper usage of trim data type
  120. GLU_NURBS_ERROR23 = 100273; // nurbscurve referenced twice
  121. GLU_NURBS_ERROR24 = 100274; // nurbscurve and pwlcurve mixed
  122. GLU_NURBS_ERROR25 = 100275; // nurbssurface referenced twice
  123. GLU_NURBS_ERROR26 = 100276; // invalid property
  124. GLU_NURBS_ERROR27 = 100277; // endsurface() must follow bgnsurface()
  125. GLU_NURBS_ERROR28 = 100278; // intersecting or misoriented trim curves
  126. GLU_NURBS_ERROR29 = 100279; // intersecting trim curves
  127. GLU_NURBS_ERROR30 = 100280; // UNUSED
  128. GLU_NURBS_ERROR31 = 100281; // unconnected trim curves
  129. GLU_NURBS_ERROR32 = 100282; // unknown knot error
  130. GLU_NURBS_ERROR33 = 100283; // negative vertex count encountered
  131. GLU_NURBS_ERROR34 = 100284; // negative byte-stride
  132. GLU_NURBS_ERROR35 = 100285; // unknown type descriptor
  133. GLU_NURBS_ERROR36 = 100286; // null control point reference
  134. GLU_NURBS_ERROR37 = 100287; // duplicate point on pwlcurve
  135. // Errors
  136. GLU_INVALID_ENUM = 100900;
  137. GLU_INVALID_VALUE = 100901;
  138. GLU_OUT_OF_MEMORY = 100902;
  139. GLU_INCOMPATIBLE_GL_VERSION = 100903;
  140. // New in GLU 1.1
  141. GLU_VERSION = 100800;
  142. GLU_EXTENSIONS = 100801;
  143. type
  144. PGLUquadricObj = ^TGLUquadricObj;
  145. TGLUquadricObj = record end;
  146. PGLUtriangulatorObj = ^TGLUtriangulatorObj;
  147. TGLUtriangulatorObj = record end;
  148. PGLUnurbsObj = ^TGLUnurbsObj;
  149. TGLUnurbsObj = record end;
  150. TGLUQuadricCallback = procedure; cdecl;
  151. TGLUNurbsCallback = procedure; cdecl;
  152. TGLUTessCallback = procedure; cdecl;
  153. TGLUViewport = array[0..3] of LongInt;
  154. TGLUMatrixd = array[0..15] of Double;
  155. TGLUMatrixf = array[0..15] of Single;
  156. TGLUVectord = array[0..2] of Double;
  157. // Miscellaneous functions
  158. procedure gluLookAt(eye, eyey, eyez, centerx, centery, centerz, upx, upy, upz: Double); glu_dll;
  159. procedure gluOrtho2D(left, right, bottom, top: Double); glu_dll;
  160. procedure gluPerspective(fovy, aspect, zNear, zFar: Double); glu_dll;
  161. procedure gluPickMatrix(x, y, width, height: Double; const viewport: TGLUViewport); glu_dll;
  162. procedure gluProject(objx, objy, objz: Double; const modelMatrix, projMatrix: TGLUMatrixd; const viewport: TGLUViewport; winx, winy, winz: Double); glu_dll;
  163. procedure gluUnProject(winx, winy, winz: Double; const modelMatrix, projMatrix: TGLUMatrixd; const viewport: TGLUViewport; objx, objy, objz: Double); glu_dll;
  164. procedure gluErrorString(errorCode: GLenum); glu_dll;
  165. // Mipmapping and image scaling
  166. procedure gluScaleImage(format: GLenum; within, heightin: LongInt; typein: GLenum; var datain; widthout, heightout: LongInt; typeout: GLenum; var dataout); glu_dll;
  167. procedure gluBuild1DMipmaps(target: GLenum; components, width: LongInt; format, AType: GLEnum; var data); glu_dll;
  168. procedure gluBuild2DMipmaps(target: GLenum; components, width, height: LongInt; format, AType: GLEnum; var data); glu_dll;
  169. // Quadrics
  170. function gluNewQuadric: PGLUquadricObj; glu_dll;
  171. procedure gluDeleteQuadric(state: PGLUquadricObj); glu_dll;
  172. procedure gluQuadricDrawStyle(quadObject: PGLUquadricObj; drawStyle: GLenum); glu_dll;
  173. procedure gluQuadricOrientation(quadObject: PGLUquadricObj; orientation: GLenum); glu_dll;
  174. procedure gluQuadricNormals(quadObject: PGLUquadricObj; normals: GLenum); glu_dll;
  175. procedure gluQuadricTexture(quadObject: PGLUquadricObj; textureCoords: Boolean); glu_dll;
  176. procedure gluQuadricCallback(quadObject: PGLUquadricObj; which: GLenum; fn: TGLUQuadricCallback); glu_dll;
  177. procedure gluCylinder(qobj: PGLUquadricObj; baseRadius, topRadius, height: Double; slices, stacks: LongInt); glu_dll;
  178. procedure gluSphere(qobj: PGLUquadricObj; radius: Double; slices, stacks: LongInt); glu_dll;
  179. procedure gluDisk(qobj: PGLUquadricObj; innerRadius, outerRadius: Double; slices, loops: LongInt); glu_dll;
  180. procedure gluPartialDisk(qobj: PGLUquadricObj; innerRadius, outerRadius: Double; slices, loops: LongInt; startAngle, sweepAngle: Double); glu_dll;
  181. // Nurbs
  182. function gluNewNurbsRenderer: PGLUnurbsObj; glu_dll;
  183. procedure gluDeleteNurbsRenderer(nobj: PGLUnurbsObj); glu_dll;
  184. procedure gluLoadSamplingMatrices(nobj: PGLUnurbsObj; const modelMatrix, projMatrix: TGLUMatrixf; const viewport: TGLUViewport); glu_dll;
  185. procedure gluNurbsProperty(nobj: PGLUnurbsObj; AProperty: GLenum; value: Single); glu_dll;
  186. procedure gluGetNurbsProperty(nobj: PGLUnurbsObj; AProperty: GLEnum; var value: Single); glu_dll;
  187. procedure gluBeginCurve(nobj: PGLUnurbsObj); glu_dll;
  188. procedure gluEndCurve(nobj: PGLUnurbsObj); glu_dll;
  189. procedure gluNurbsCurve(nobj: PGLUnurbsObj; nknots: LongInt; var know: Single; stride: LongInt; var ctlarray: Single; order: LongInt; AType: GLenum); glu_dll;
  190. procedure gluBeginSurface(nobj: PGLUnurbsObj); glu_dll;
  191. procedure gluEndSurface(nobj: PGLUnurbsObj); glu_dll;
  192. procedure gluNurbsSurface(nobj: PGLUnurbsObj; sknot_count: LongInt; var sknot: Single; tknot_count: LongInt; var tknot: Single; s_stride, t_stride: LongInt; var ctlarray: Single; sorder, torder: LongInt; AType: GLenum); glu_dll;
  193. procedure gluBeginTrim(nobj: PGLUnurbsObj); glu_dll;
  194. procedure gluEndTrim(nobj: PGLUnurbsObj); glu_dll;
  195. procedure gluPwlCurve(nobj: PGLUnurbsObj; count: LongInt; var AArray: Single; stride: LongInt; AType: GLenum); glu_dll;
  196. procedure gluNurbsCallback(nobj: PGLUnurbsObj; which: GLenum; fn: TGLUNurbsCallback); glu_dll;
  197. // Polygon tesselation
  198. function gluNewTess: PGLUtriangulatorObj; glu_dll;
  199. procedure gluTessCallback(tobj: PGLUtriangulatorObj; which: GLenum; fn: TGLUTessCallback); glu_dll;
  200. procedure gluDeleteTess(tobj: PGLUtriangulatorObj); glu_dll;
  201. procedure gluBeginPolygon(tobj: PGLUtriangulatorObj); glu_dll;
  202. procedure gluEndPolygon(tobj: PGLUtriangulatorObj); glu_dll;
  203. procedure gluNextContour(tobj: PGLUtriangulatorObj; AType: GLenum); glu_dll;
  204. procedure gluTessVertex(tobj: PGLUtriangulatorObj; v: TGLUVectord; var data); glu_dll;
  205. // New functions in GLU 1.1
  206. function gluGetString(name: GLenum): PChar; glu_dll;
  207. // =======================================================
  208. //
  209. // =======================================================
  210. implementation
  211. {BEGIN{OF INIT}
  212. end.
  213. {
  214. $Log$
  215. Revision 1.3 2000-10-01 22:17:59 peter
  216. * new bounce demo
  217. Revision 1.1.2.2 2000/10/01 22:12:28 peter
  218. * new demo
  219. Revision 1.1 2000/09/03 21:25:45 peter
  220. * new updated version
  221. * gtkglarea unit and demo
  222. * win32 opengl headers
  223. * morph3d demo
  224. Revision 1.1 2000/07/13 06:34:18 michael
  225. + Initial import
  226. Revision 1.1 2000/05/31 00:35:14 alex
  227. added working templates
  228. }
  229. {
  230. $Log$
  231. Revision 1.3 2000-10-01 22:17:59 peter
  232. * new bounce demo
  233. Revision 1.1.2.2 2000/10/01 22:12:28 peter
  234. * new demo
  235. }