glu.pp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. {
  2. Adaption of the delphi3d.net OpenGL units to FreePascal
  3. Sebastian Guenther ([email protected]) in 2002
  4. These units are free to use
  5. }
  6. (*++ BUILD Version: 0004 // Increment this if a change has global effects
  7. Copyright (c) 1985-95, Microsoft Corporation
  8. Module Name:
  9. glu.h
  10. Abstract:
  11. Procedure declarations, constant definitions and macros for the OpenGL
  12. Utility Library.
  13. --*)
  14. (*
  15. ** Copyright 1991-1993, Silicon Graphics, Inc.
  16. ** All Rights Reserved.
  17. **
  18. ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  19. ** the contents of this file may not be disclosed to third parties, copied or
  20. ** duplicated in any form, in whole or in part, without the prior written
  21. ** permission of Silicon Graphics, Inc.
  22. **
  23. ** RESTRICTED RIGHTS LEGEND:
  24. ** Use, duplication or disclosure by the Government is subject to restrictions
  25. ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  26. ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  27. ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  28. ** rights reserved under the Copyright Laws of the United States.
  29. *)
  30. (*
  31. ** Return the error string associated with a particular error code.
  32. ** This will return 0 for an invalid error code.
  33. **
  34. ** The generic function prototype that can be compiled for ANSI or Unicode
  35. ** is defined as follows:
  36. **
  37. ** LPCTSTR APIENTRY gluErrorStringWIN (GLenum errCode);
  38. *)
  39. {******************************************************************************}
  40. { Converted to Delphi by Tom Nuydens ([email protected]) }
  41. { For the latest updates, visit Delphi3D: http://www.delphi3d.net }
  42. {******************************************************************************}
  43. {$MACRO ON}
  44. {$MODE Delphi}
  45. {$IFDEF Win32}
  46. {$DEFINE extdecl := stdcall}
  47. {$ELSE}
  48. {$DEFINE extdecl := cdecl}
  49. {$ENDIF}
  50. unit GLu;
  51. interface
  52. uses
  53. SysUtils,
  54. {$IFDEF Win32}
  55. Windows,
  56. {$ELSE}
  57. DLLFuncs,
  58. {$ENDIF}
  59. GL;
  60. type
  61. TViewPortArray = array [0..3] of GLint;
  62. T16dArray = array [0..15] of GLdouble;
  63. TCallBack = procedure;
  64. T3dArray = array [0..2] of GLdouble;
  65. T4pArray = array [0..3] of Pointer;
  66. T4fArray = array [0..3] of GLfloat;
  67. PPointer = ^Pointer;
  68. var
  69. gluErrorString: function(errCode: GLenum): PChar; extdecl;
  70. gluErrorUnicodeStringEXT: function(errCode: GLenum): PWideChar; extdecl;
  71. gluGetString: function(name: GLenum): PChar; extdecl;
  72. gluOrtho2D: procedure(left,right, bottom, top: GLdouble); extdecl;
  73. gluPerspective: procedure(fovy, aspect, zNear, zFar: GLdouble); extdecl;
  74. gluPickMatrix: procedure(x, y, width, height: GLdouble; var viewport: TViewPortArray); extdecl;
  75. gluLookAt: procedure(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz: GLdouble); extdecl;
  76. gluProject: function(objx, objy, objz: GLdouble; var modelMatrix, projMatrix: T16dArray; var viewport: TViewPortArray; winx, winy, winz: PGLdouble): Integer; extdecl;
  77. gluUnProject: function(winx, winy, winz: GLdouble; var modelMatrix, projMatrix: T16dArray; var viewport: TViewPortArray; objx, objy, objz: PGLdouble): Integer; extdecl;
  78. gluScaleImage: function(format: GLenum; widthin, heightin: GLint; typein: GLenum; const datain: Pointer; widthout, heightout: GLint; typeout: GLenum; dataout: Pointer): Integer; extdecl;
  79. gluBuild1DMipmaps: function(target: GLenum; components, width: GLint; format, atype: GLenum; const data: Pointer): Integer; extdecl;
  80. gluBuild2DMipmaps: function(target: GLenum; components, width, height: GLint; format, atype: GLenum; const data: Pointer): Integer; extdecl;
  81. type
  82. GLUnurbs = record end; PGLUnurbs = ^GLUnurbs;
  83. GLUquadric = record end; PGLUquadric = ^GLUquadric;
  84. GLUtesselator = record end; PGLUtesselator = ^GLUtesselator;
  85. // backwards compatibility:
  86. GLUnurbsObj = GLUnurbs; PGLUnurbsObj = PGLUnurbs;
  87. GLUquadricObj = GLUquadric; PGLUquadricObj = PGLUquadric;
  88. GLUtesselatorObj = GLUtesselator; PGLUtesselatorObj = PGLUtesselator;
  89. GLUtriangulatorObj = GLUtesselator; PGLUtriangulatorObj = PGLUtesselator;
  90. var
  91. gluNewQuadric: function: PGLUquadric; extdecl;
  92. gluDeleteQuadric: procedure(state: PGLUquadric); extdecl;
  93. gluQuadricNormals: procedure(quadObject: PGLUquadric; normals: GLenum); extdecl;
  94. gluQuadricTexture: procedure(quadObject: PGLUquadric; textureCoords: GLboolean); extdecl;
  95. gluQuadricOrientation: procedure(quadObject: PGLUquadric; orientation: GLenum); extdecl;
  96. gluQuadricDrawStyle: procedure(quadObject: PGLUquadric; drawStyle: GLenum); extdecl;
  97. gluCylinder: procedure(qobj: PGLUquadric; baseRadius, topRadius, height: GLdouble; slices, stacks: GLint); extdecl;
  98. gluDisk: procedure(qobj: PGLUquadric; innerRadius, outerRadius: GLdouble; slices, loops: GLint); extdecl;
  99. gluPartialDisk: procedure(qobj: PGLUquadric; innerRadius, outerRadius: GLdouble; slices, loops: GLint; startAngle, sweepAngle: GLdouble); extdecl;
  100. gluSphere: procedure(qobj: PGLuquadric; radius: GLdouble; slices, stacks: GLint); extdecl;
  101. gluQuadricCallback: procedure(qobj: PGLUquadric; which: GLenum; fn: TCallBack); extdecl;
  102. gluNewTess: function: PGLUtesselator; extdecl;
  103. gluDeleteTess: procedure(tess: PGLUtesselator); extdecl;
  104. gluTessBeginPolygon: procedure(tess: PGLUtesselator; polygon_data: Pointer); extdecl;
  105. gluTessBeginContour: procedure(tess: PGLUtesselator); extdecl;
  106. gluTessVertex: procedure(tess: PGLUtesselator; var coords: T3dArray; data: Pointer); extdecl;
  107. gluTessEndContour: procedure(tess: PGLUtesselator); extdecl;
  108. gluTessEndPolygon: procedure(tess: PGLUtesselator); extdecl;
  109. gluTessProperty: procedure(tess: PGLUtesselator; which: GLenum; value: GLdouble); extdecl;
  110. gluTessNormal: procedure(tess: PGLUtesselator; x, y, z: GLdouble); extdecl;
  111. gluTessCallback: procedure(tess: PGLUtesselator; which: GLenum;fn: TCallBack); extdecl;
  112. gluGetTessProperty: procedure(tess: PGLUtesselator; which: GLenum; value: PGLdouble); extdecl;
  113. gluNewNurbsRenderer: function: PGLUnurbs; extdecl;
  114. gluDeleteNurbsRenderer: procedure(nobj: PGLUnurbs); extdecl;
  115. gluBeginSurface: procedure(nobj: PGLUnurbs); extdecl;
  116. gluBeginCurve: procedure(nobj: PGLUnurbs); extdecl;
  117. gluEndCurve: procedure(nobj: PGLUnurbs); extdecl;
  118. gluEndSurface: procedure(nobj: PGLUnurbs); extdecl;
  119. gluBeginTrim: procedure(nobj: PGLUnurbs); extdecl;
  120. gluEndTrim: procedure(nobj: PGLUnurbs); extdecl;
  121. gluPwlCurve: procedure(nobj: PGLUnurbs; count: GLint; aarray: PGLfloat; stride: GLint; atype: GLenum); extdecl;
  122. gluNurbsCurve: procedure(nobj: PGLUnurbs; nknots: GLint; knot: PGLfloat; stride: GLint; ctlarray: PGLfloat; order: GLint; atype: GLenum); extdecl;
  123. gluNurbsSurface: procedure(nobj: PGLUnurbs; sknot_count: GLint; sknot: PGLfloat; tknot_count: GLint; tknot: PGLfloat; s_stride, t_stride: GLint; ctlarray: PGLfloat; sorder, torder: GLint; atype: GLenum); extdecl;
  124. gluLoadSamplingMatrices: procedure(nobj: PGLUnurbs; var modelMatrix, projMatrix: T16dArray; var viewport: TViewPortArray); extdecl;
  125. gluNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: GLenum; value: GLfloat); extdecl;
  126. gluGetNurbsProperty: procedure(nobj: PGLUnurbs; aproperty: GLenum; value: PGLfloat); extdecl;
  127. gluNurbsCallback: procedure(nobj: PGLUnurbs; which: GLenum; fn: TCallBack); extdecl;
  128. (**** Callback function prototypes ****)
  129. type
  130. // gluQuadricCallback
  131. GLUquadricErrorProc = procedure(p: GLenum); extdecl;
  132. // gluTessCallback
  133. GLUtessBeginProc = procedure(p: GLenum); extdecl;
  134. GLUtessEdgeFlagProc = procedure(p: GLboolean); extdecl;
  135. GLUtessVertexProc = procedure(p: Pointer); extdecl;
  136. GLUtessEndProc = procedure; extdecl;
  137. GLUtessErrorProc = procedure(p: GLenum); extdecl;
  138. GLUtessCombineProc = procedure(var p1: T3dArray; p2: T4pArray; p3: T4fArray; p4: PPointer); extdecl;
  139. GLUtessBeginDataProc = procedure(p1: GLenum; p2: Pointer); extdecl;
  140. GLUtessEdgeFlagDataProc = procedure(p1: GLboolean; p2: Pointer); extdecl;
  141. GLUtessVertexDataProc = procedure(p1, p2: Pointer); extdecl;
  142. GLUtessEndDataProc = procedure(p: Pointer); extdecl;
  143. GLUtessErrorDataProc = procedure(p1: GLenum; p2: Pointer); extdecl;
  144. GLUtessCombineDataProc = procedure(var p1: T3dArray; var p2: T4pArray; var p3: T4fArray;
  145. p4: PPointer; p5: Pointer); extdecl;
  146. // gluNurbsCallback
  147. GLUnurbsErrorProc = procedure(p: GLenum); extdecl;
  148. //*** Generic constants ****/
  149. const
  150. // Version
  151. GLU_VERSION_1_1 = 1;
  152. GLU_VERSION_1_2 = 1;
  153. // Errors: (return value 0 = no error)
  154. GLU_INVALID_ENUM = 100900;
  155. GLU_INVALID_VALUE = 100901;
  156. GLU_OUT_OF_MEMORY = 100902;
  157. GLU_INCOMPATIBLE_GL_VERSION = 100903;
  158. // StringName
  159. GLU_VERSION = 100800;
  160. GLU_EXTENSIONS = 100801;
  161. // Boolean
  162. GLU_TRUE = GL_TRUE;
  163. GLU_FALSE = GL_FALSE;
  164. //*** Quadric constants ****/
  165. // QuadricNormal
  166. GLU_SMOOTH = 100000;
  167. GLU_FLAT = 100001;
  168. GLU_NONE = 100002;
  169. // QuadricDrawStyle
  170. GLU_POINT = 100010;
  171. GLU_LINE = 100011;
  172. GLU_FILL = 100012;
  173. GLU_SILHOUETTE = 100013;
  174. // QuadricOrientation
  175. GLU_OUTSIDE = 100020;
  176. GLU_INSIDE = 100021;
  177. // Callback types:
  178. // GLU_ERROR = 100103;
  179. //*** Tesselation constants ****/
  180. GLU_TESS_MAX_COORD = 1.0e150;
  181. // TessProperty
  182. GLU_TESS_WINDING_RULE = 100140;
  183. GLU_TESS_BOUNDARY_ONLY = 100141;
  184. GLU_TESS_TOLERANCE = 100142;
  185. // TessWinding
  186. GLU_TESS_WINDING_ODD = 100130;
  187. GLU_TESS_WINDING_NONZERO = 100131;
  188. GLU_TESS_WINDING_POSITIVE = 100132;
  189. GLU_TESS_WINDING_NEGATIVE = 100133;
  190. GLU_TESS_WINDING_ABS_GEQ_TWO = 100134;
  191. // TessCallback
  192. GLU_TESS_BEGIN = 100100; // void (CALLBACK*)(GLenum type)
  193. GLU_TESS_VERTEX = 100101; // void (CALLBACK*)(void *data)
  194. GLU_TESS_END = 100102; // void (CALLBACK*)(void)
  195. GLU_TESS_ERROR = 100103; // void (CALLBACK*)(GLenum errno)
  196. GLU_TESS_EDGE_FLAG = 100104; // void (CALLBACK*)(GLboolean boundaryEdge)
  197. GLU_TESS_COMBINE = 100105; { void (CALLBACK*)(GLdouble coords[3],
  198. void *data[4],
  199. GLfloat weight[4],
  200. void **dataOut) }
  201. GLU_TESS_BEGIN_DATA = 100106; { void (CALLBACK*)(GLenum type,
  202. void *polygon_data) }
  203. GLU_TESS_VERTEX_DATA = 100107; { void (CALLBACK*)(void *data,
  204. void *polygon_data) }
  205. GLU_TESS_END_DATA = 100108; // void (CALLBACK*)(void *polygon_data)
  206. GLU_TESS_ERROR_DATA = 100109; { void (CALLBACK*)(GLenum errno,
  207. void *polygon_data) }
  208. GLU_TESS_EDGE_FLAG_DATA = 100110; { void (CALLBACK*)(GLboolean boundaryEdge,
  209. void *polygon_data) }
  210. GLU_TESS_COMBINE_DATA = 100111; { void (CALLBACK*)(GLdouble coords[3],
  211. void *data[4],
  212. GLfloat weight[4],
  213. void **dataOut,
  214. void *polygon_data) }
  215. // TessError
  216. GLU_TESS_ERROR1 = 100151;
  217. GLU_TESS_ERROR2 = 100152;
  218. GLU_TESS_ERROR3 = 100153;
  219. GLU_TESS_ERROR4 = 100154;
  220. GLU_TESS_ERROR5 = 100155;
  221. GLU_TESS_ERROR6 = 100156;
  222. GLU_TESS_ERROR7 = 100157;
  223. GLU_TESS_ERROR8 = 100158;
  224. GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1;
  225. GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2;
  226. GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3;
  227. GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4;
  228. GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5;
  229. GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6;
  230. //*** NURBS constants ****/
  231. // NurbsProperty
  232. GLU_AUTO_LOAD_MATRIX = 100200;
  233. GLU_CULLING = 100201;
  234. GLU_SAMPLING_TOLERANCE = 100203;
  235. GLU_DISPLAY_MODE = 100204;
  236. GLU_PARAMETRIC_TOLERANCE = 100202;
  237. GLU_SAMPLING_METHOD = 100205;
  238. GLU_U_STEP = 100206;
  239. GLU_V_STEP = 100207;
  240. // NurbsSampling
  241. GLU_PATH_LENGTH = 100215;
  242. GLU_PARAMETRIC_ERROR = 100216;
  243. GLU_DOMAIN_DISTANCE = 100217;
  244. // NurbsTrim
  245. GLU_MAP1_TRIM_2 = 100210;
  246. GLU_MAP1_TRIM_3 = 100211;
  247. // NurbsDisplay
  248. // GLU_FILL = 100012;
  249. GLU_OUTLINE_POLYGON = 100240;
  250. GLU_OUTLINE_PATCH = 100241;
  251. // NurbsCallback
  252. // GLU_ERROR = 100103;
  253. // NurbsErrors
  254. GLU_NURBS_ERROR1 = 100251;
  255. GLU_NURBS_ERROR2 = 100252;
  256. GLU_NURBS_ERROR3 = 100253;
  257. GLU_NURBS_ERROR4 = 100254;
  258. GLU_NURBS_ERROR5 = 100255;
  259. GLU_NURBS_ERROR6 = 100256;
  260. GLU_NURBS_ERROR7 = 100257;
  261. GLU_NURBS_ERROR8 = 100258;
  262. GLU_NURBS_ERROR9 = 100259;
  263. GLU_NURBS_ERROR10 = 100260;
  264. GLU_NURBS_ERROR11 = 100261;
  265. GLU_NURBS_ERROR12 = 100262;
  266. GLU_NURBS_ERROR13 = 100263;
  267. GLU_NURBS_ERROR14 = 100264;
  268. GLU_NURBS_ERROR15 = 100265;
  269. GLU_NURBS_ERROR16 = 100266;
  270. GLU_NURBS_ERROR17 = 100267;
  271. GLU_NURBS_ERROR18 = 100268;
  272. GLU_NURBS_ERROR19 = 100269;
  273. GLU_NURBS_ERROR20 = 100270;
  274. GLU_NURBS_ERROR21 = 100271;
  275. GLU_NURBS_ERROR22 = 100272;
  276. GLU_NURBS_ERROR23 = 100273;
  277. GLU_NURBS_ERROR24 = 100274;
  278. GLU_NURBS_ERROR25 = 100275;
  279. GLU_NURBS_ERROR26 = 100276;
  280. GLU_NURBS_ERROR27 = 100277;
  281. GLU_NURBS_ERROR28 = 100278;
  282. GLU_NURBS_ERROR29 = 100279;
  283. GLU_NURBS_ERROR30 = 100280;
  284. GLU_NURBS_ERROR31 = 100281;
  285. GLU_NURBS_ERROR32 = 100282;
  286. GLU_NURBS_ERROR33 = 100283;
  287. GLU_NURBS_ERROR34 = 100284;
  288. GLU_NURBS_ERROR35 = 100285;
  289. GLU_NURBS_ERROR36 = 100286;
  290. GLU_NURBS_ERROR37 = 100287;
  291. //*** Backwards compatibility for old tesselator ****/
  292. var
  293. gluBeginPolygon: procedure(tess: PGLUtesselator); extdecl;
  294. gluNextContour: procedure(tess: PGLUtesselator; atype: GLenum); extdecl;
  295. gluEndPolygon: procedure(tess: PGLUtesselator); extdecl;
  296. const
  297. // Contours types -- obsolete!
  298. GLU_CW = 100120;
  299. GLU_CCW = 100121;
  300. GLU_INTERIOR = 100122;
  301. GLU_EXTERIOR = 100123;
  302. GLU_UNKNOWN = 100124;
  303. // Names without "TESS_" prefix
  304. GLU_BEGIN = GLU_TESS_BEGIN;
  305. GLU_VERTEX = GLU_TESS_VERTEX;
  306. GLU_END = GLU_TESS_END;
  307. GLU_ERROR = GLU_TESS_ERROR;
  308. GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG;
  309. procedure LoadGLu(const dll: String);
  310. procedure FreeGLu;
  311. implementation
  312. var
  313. hDLL: THandle;
  314. procedure FreeGLu;
  315. begin
  316. @gluErrorString := nil;
  317. @gluErrorUnicodeStringEXT := nil;
  318. @gluGetString := nil;
  319. @gluOrtho2D := nil;
  320. @gluPerspective := nil;
  321. @gluPickMatrix := nil;
  322. @gluLookAt := nil;
  323. @gluProject := nil;
  324. @gluUnProject := nil;
  325. @gluScaleImage := nil;
  326. @gluBuild1DMipmaps := nil;
  327. @gluBuild2DMipmaps := nil;
  328. @gluNewQuadric := nil;
  329. @gluDeleteQuadric := nil;
  330. @gluQuadricNormals := nil;
  331. @gluQuadricTexture := nil;
  332. @gluQuadricOrientation := nil;
  333. @gluQuadricDrawStyle := nil;
  334. @gluCylinder := nil;
  335. @gluDisk := nil;
  336. @gluPartialDisk := nil;
  337. @gluSphere := nil;
  338. @gluQuadricCallback := nil;
  339. @gluNewTess := nil;
  340. @gluDeleteTess := nil;
  341. @gluTessBeginPolygon := nil;
  342. @gluTessBeginContour := nil;
  343. @gluTessVertex := nil;
  344. @gluTessEndContour := nil;
  345. @gluTessEndPolygon := nil;
  346. @gluTessProperty := nil;
  347. @gluTessNormal := nil;
  348. @gluTessCallback := nil;
  349. @gluGetTessProperty := nil;
  350. @gluNewNurbsRenderer := nil;
  351. @gluDeleteNurbsRenderer := nil;
  352. @gluBeginSurface := nil;
  353. @gluBeginCurve := nil;
  354. @gluEndCurve := nil;
  355. @gluEndSurface := nil;
  356. @gluBeginTrim := nil;
  357. @gluEndTrim := nil;
  358. @gluPwlCurve := nil;
  359. @gluNurbsCurve := nil;
  360. @gluNurbsSurface := nil;
  361. @gluLoadSamplingMatrices := nil;
  362. @gluNurbsProperty := nil;
  363. @gluGetNurbsProperty := nil;
  364. @gluNurbsCallback := nil;
  365. @gluBeginPolygon := nil;
  366. @gluNextContour := nil;
  367. @gluEndPolygon := nil;
  368. FreeLibrary(hDLL);
  369. end;
  370. procedure LoadGLu(const dll: String);
  371. var
  372. MethodName: string = '';
  373. function GetGLuProcAddress(Lib: PtrInt; ProcName: PChar): Pointer;
  374. begin
  375. MethodName:=ProcName;
  376. Result:=GetProcAddress(Lib, ProcName);
  377. end;
  378. begin
  379. FreeGLu;
  380. hDLL := LoadLibrary(PChar(dll));
  381. if hDLL = 0 then raise Exception.Create('Could not load GLu from ' + dll);
  382. try
  383. @gluErrorString := GetGLuProcAddress(hDLL, 'gluErrorString');
  384. @gluErrorUnicodeStringEXT := GetGLuProcAddress(hDLL, 'gluErrorUnicodeStringEXT');
  385. @gluGetString := GetGLuProcAddress(hDLL, 'gluGetString');
  386. @gluOrtho2D := GetGLuProcAddress(hDLL, 'gluOrtho2D');
  387. @gluPerspective := GetGLuProcAddress(hDLL, 'gluPerspective');
  388. @gluPickMatrix := GetGLuProcAddress(hDLL, 'gluPickMatrix');
  389. @gluLookAt := GetGLuProcAddress(hDLL, 'gluLookAt');
  390. @gluProject := GetGLuProcAddress(hDLL, 'gluProject');
  391. @gluUnProject := GetGLuProcAddress(hDLL, 'gluUnProject');
  392. @gluScaleImage := GetGLuProcAddress(hDLL, 'gluScaleImage');
  393. @gluBuild1DMipmaps := GetGLuProcAddress(hDLL, 'gluBuild1DMipmaps');
  394. @gluBuild2DMipmaps := GetGLuProcAddress(hDLL, 'gluBuild2DMipmaps');
  395. @gluNewQuadric := GetGLuProcAddress(hDLL, 'gluNewQuadric');
  396. @gluDeleteQuadric := GetGLuProcAddress(hDLL, 'gluDeleteQuadric');
  397. @gluQuadricNormals := GetGLuProcAddress(hDLL, 'gluQuadricNormals');
  398. @gluQuadricTexture := GetGLuProcAddress(hDLL, 'gluQuadricTexture');
  399. @gluQuadricOrientation := GetGLuProcAddress(hDLL, 'gluQuadricOrientation');
  400. @gluQuadricDrawStyle := GetGLuProcAddress(hDLL, 'gluQuadricDrawStyle');
  401. @gluCylinder := GetGLuProcAddress(hDLL, 'gluCylinder');
  402. @gluDisk := GetGLuProcAddress(hDLL, 'gluDisk');
  403. @gluPartialDisk := GetGLuProcAddress(hDLL, 'gluPartialDisk');
  404. @gluSphere := GetGLuProcAddress(hDLL, 'gluSphere');
  405. @gluQuadricCallback := GetGLuProcAddress(hDLL, 'gluQuadricCallback');
  406. @gluNewTess := GetGLuProcAddress(hDLL, 'gluNewTess');
  407. @gluDeleteTess := GetGLuProcAddress(hDLL, 'gluDeleteTess');
  408. @gluTessBeginPolygon := GetGLuProcAddress(hDLL, 'gluTessBeginPolygon');
  409. @gluTessBeginContour := GetGLuProcAddress(hDLL, 'gluTessBeginContour');
  410. @gluTessVertex := GetGLuProcAddress(hDLL, 'gluTessVertex');
  411. @gluTessEndContour := GetGLuProcAddress(hDLL, 'gluTessEndContour');
  412. @gluTessEndPolygon := GetGLuProcAddress(hDLL, 'gluTessEndPolygon');
  413. @gluTessProperty := GetGLuProcAddress(hDLL, 'gluTessProperty');
  414. @gluTessNormal := GetGLuProcAddress(hDLL, 'gluTessNormal');
  415. @gluTessCallback := GetGLuProcAddress(hDLL, 'gluTessCallback');
  416. @gluGetTessProperty := GetGLuProcAddress(hDLL, 'gluGetTessProperty');
  417. @gluNewNurbsRenderer := GetGLuProcAddress(hDLL, 'gluNewNurbsRenderer');
  418. @gluDeleteNurbsRenderer := GetGLuProcAddress(hDLL, 'gluDeleteNurbsRenderer');
  419. @gluBeginSurface := GetGLuProcAddress(hDLL, 'gluBeginSurface');
  420. @gluBeginCurve := GetGLuProcAddress(hDLL, 'gluBeginCurve');
  421. @gluEndCurve := GetGLuProcAddress(hDLL, 'gluEndCurve');
  422. @gluEndSurface := GetGLuProcAddress(hDLL, 'gluEndSurface');
  423. @gluBeginTrim := GetGLuProcAddress(hDLL, 'gluBeginTrim');
  424. @gluEndTrim := GetGLuProcAddress(hDLL, 'gluEndTrim');
  425. @gluPwlCurve := GetGLuProcAddress(hDLL, 'gluPwlCurve');
  426. @gluNurbsCurve := GetGLuProcAddress(hDLL, 'gluNurbsCurve');
  427. @gluNurbsSurface := GetGLuProcAddress(hDLL, 'gluNurbsSurface');
  428. @gluLoadSamplingMatrices := GetGLuProcAddress(hDLL, 'gluLoadSamplingMatrices');
  429. @gluNurbsProperty := GetGLuProcAddress(hDLL, 'gluNurbsProperty');
  430. @gluGetNurbsProperty := GetGLuProcAddress(hDLL, 'gluGetNurbsProperty');
  431. @gluNurbsCallback := GetGLuProcAddress(hDLL, 'gluNurbsCallback');
  432. @gluBeginPolygon := GetGLuProcAddress(hDLL, 'gluBeginPolygon');
  433. @gluNextContour := GetGLuProcAddress(hDLL, 'gluNextContour');
  434. @gluEndPolygon := GetGLuProcAddress(hDLL, 'gluEndPolygon');
  435. except
  436. raise Exception.Create('Could not load ' + MethodName + ' from ' + dll);
  437. end;
  438. end;
  439. initialization
  440. {$IFDEF Win32}
  441. LoadGLu('glu32.dll');
  442. {$ELSE}
  443. {$ifdef darwin}
  444. LoadGLu('/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib');
  445. {$else}
  446. LoadGLu('libGLU.so.1');
  447. {$ENDIF}
  448. {$endif}
  449. finalization
  450. FreeGLu;
  451. end.