DEADSOFTWARE

d438beb4ae8a608a6406a3072d67bbbf10d01651
[d2df-sdl.git] / src / lib / nanogl / nanoGL.pas
1 (*
2 * Copyright (C) 2007-2009 Olli Hinkka
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 *
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *)
20 (* Sources: https://github.com/FWGS/nanogl *)
21 unit nanoGL;
23 interface
25 uses ctypes;
27 const
28 {$IF DEFINED(WINDOWS)}
29 nanoGL_LibName = 'nanoGL.dll';
30 {$ELSEIF DEFINED(DARWIN)}
31 nanoGL_LibName = 'libnanoGL.dylib';
32 {$ELSEIF DEFINED(UNIX)}
33 nanoGL_LibName = 'libnanoGL.so';
34 {$ENDIF}
36 type
37 GLenum = Cardinal; PGLenum = ^GLenum;
38 GLboolean = Byte; PGLboolean = ^GLboolean;
39 GLbitfield = Cardinal; PGLbitfield = ^GLbitfield;
40 GLbyte = ShortInt; PGLbyte = ^GLbyte;
41 GLshort = SmallInt; PGLshort = ^GLshort;
42 GLint = Integer; PGLint = ^GLint;
43 GLsizei = Integer; PGLsizei = ^GLsizei;
44 GLubyte = Byte; PGLubyte = ^GLubyte;
45 GLushort = Word; PGLushort = ^GLushort;
46 GLuint = Cardinal; PGLuint = ^GLuint;
47 GLfloat = Single; PGLfloat = ^GLfloat;
48 GLclampf = Single; PGLclampf = ^GLclampf;
49 GLdouble = Double; PGLdouble = ^GLdouble;
50 GLclampd = Double; PGLclampd = ^GLclampd;
51 { GLvoid = void; } PGLvoid = Pointer;
52 PPGLvoid = ^PGLvoid;
53 GLfixed = Integer; PGLfixed = ^Integer;
54 GLclampx = Integer; PGLclampx = ^Integer;
56 TGLenum = GLenum;
57 TGLboolean = GLboolean;
58 TGLbitfield = GLbitfield;
59 TGLbyte = GLbyte;
60 TGLshort = GLshort;
61 TGLint = GLint;
62 TGLsizei = GLsizei;
63 TGLubyte = GLubyte;
64 TGLushort = GLushort;
65 TGLuint = GLuint;
66 TGLfloat = GLfloat;
67 TGLclampf = GLclampf;
68 TGLdouble = GLdouble;
69 TGLclampd = GLclampd;
70 TGLfixed = GLfixed;
71 TGLclampx = GLclampx;
73 const
75 (* Boolean values *)
76 GL_FALSE = $0;
77 GL_TRUE = $1;
79 (* Data types *)
80 GL_BYTE = $1400;
81 GL_UNSIGNED_BYTE = $1401;
82 GL_SHORT = $1402;
83 GL_UNSIGNED_SHORT = $1403;
84 GL_INT = $1404;
85 GL_UNSIGNED_INT = $1405;
86 GL_FLOAT = $1406;
87 GL_2_BYTES = $1407;
88 GL_3_BYTES = $1408;
89 GL_4_BYTES = $1409;
90 GL_DOUBLE = $140A;
92 (* StringName *)
93 GL_VENDOR = $1F00;
94 GL_RENDERER = $1F01;
95 GL_VERSION = $1F02;
96 GL_EXTENSIONS = $1F03;
98 (* TextureEnvMode *)
99 GL_MODULATE = $2100;
100 GL_DECAL = $2101;
101 (* GL_BLEND *)
102 GL_ADD = $0104;
103 (* GL_REPLACE *)
105 (* Primitives *)
106 GL_POINTS = $0000;
107 GL_LINES = $0001;
108 GL_LINE_LOOP = $0002;
109 GL_LINE_STRIP = $0003;
110 GL_TRIANGLES = $0004;
111 GL_TRIANGLE_STRIP = $0005;
112 GL_TRIANGLE_FAN = $0006;
113 GL_QUADS = $0007;
114 GL_QUAD_STRIP = $0008;
115 GL_POLYGON = $0009;
117 (* EnableCap *)
118 // GL_FOG = $0B60;
119 // GL_LIGHTING = $0B50;
120 // GL_TEXTURE_2D = $0DE1;
121 // GL_CULL_FACE = $0B44;
122 GL_ALPHA_TEST = $0BC0;
123 // GL_BLEND = $0BE2;
124 // GL_COLOR_LOGIC_OP = $0BF2;
125 // GL_DITHER = $0BD0;
126 // GL_STENCIL_TEST = $0B90;
127 // GL_DEPTH_TEST = $0B71;
128 (* GL_LIGHT0 *)
129 (* GL_LIGHT1 *)
130 (* GL_LIGHT2 *)
131 (* GL_LIGHT3 *)
132 (* GL_LIGHT4 *)
133 (* GL_LIGHT5 *)
134 (* GL_LIGHT6 *)
135 (* GL_LIGHT7 *)
136 GL_POINT_SMOOTH = $0B10;
137 GL_LINE_SMOOTH = $0B20;
138 GL_SCISSOR_TEST = $0C11;
139 // GL_COLOR_MATERIAL = $0B57;
140 // GL_NORMALIZE = $0BA1;
141 GL_RESCALE_NORMAL = $803A;
142 // GL_POLYGON_OFFSET_FILL = $8037;
143 GL_VERTEX_ARRAY = $8074;
144 GL_NORMAL_ARRAY = $8075;
145 GL_COLOR_ARRAY = $8076;
146 GL_TEXTURE_COORD_ARRAY = $8078;
147 GL_MULTISAMPLE = $809D;
148 GL_SAMPLE_ALPHA_TO_COVERAGE = $809E;
149 GL_SAMPLE_ALPHA_TO_ONE = $809F;
150 GL_SAMPLE_COVERAGE = $80A0;
152 (* Texture mapping *)
153 GL_TEXTURE_ENV = $2300;
154 GL_TEXTURE_ENV_MODE = $2200;
155 GL_TEXTURE_1D = $0DE0;
156 GL_TEXTURE_2D = $0DE1;
157 GL_TEXTURE_WRAP_S = $2802;
158 GL_TEXTURE_WRAP_T = $2803;
159 GL_TEXTURE_MAG_FILTER = $2800;
160 GL_TEXTURE_MIN_FILTER = $2801;
161 GL_TEXTURE_ENV_COLOR = $2201;
162 GL_TEXTURE_GEN_S = $0C60;
163 GL_TEXTURE_GEN_T = $0C61;
164 GL_TEXTURE_GEN_MODE = $2500;
165 GL_TEXTURE_BORDER_COLOR = $1004;
166 GL_TEXTURE_WIDTH = $1000;
167 GL_TEXTURE_HEIGHT = $1001;
168 GL_TEXTURE_BORDER = $1005;
169 GL_TEXTURE_COMPONENTS = $1003;
170 GL_TEXTURE_RED_SIZE = $805C;
171 GL_TEXTURE_GREEN_SIZE = $805D;
172 GL_TEXTURE_BLUE_SIZE = $805E;
173 GL_TEXTURE_ALPHA_SIZE = $805F;
174 GL_TEXTURE_LUMINANCE_SIZE = $8060;
175 GL_TEXTURE_INTENSITY_SIZE = $8061;
176 GL_NEAREST_MIPMAP_NEAREST = $2700;
177 GL_NEAREST_MIPMAP_LINEAR = $2702;
178 GL_LINEAR_MIPMAP_NEAREST = $2701;
179 GL_LINEAR_MIPMAP_LINEAR = $2703;
180 GL_OBJECT_LINEAR = $2401;
181 GL_OBJECT_PLANE = $2501;
182 GL_EYE_LINEAR = $2400;
183 GL_EYE_PLANE = $2502;
184 GL_SPHERE_MAP = $2402;
185 // GL_DECAL = $2101;
186 // GL_MODULATE = $2100;
187 GL_NEAREST = $2600;
188 GL_REPEAT = $2901;
189 GL_CLAMP = $2900;
190 GL_S = $2000;
191 GL_T = $2001;
192 GL_R = $2002;
193 GL_Q = $2003;
194 GL_TEXTURE_GEN_R = $0C62;
195 GL_TEXTURE_GEN_Q = $0C63;
196 GL_CLAMP_TO_EDGE = $812F;
198 (* Matrix Mode *)
199 GL_MATRIX_MODE = $0BA0;
200 GL_MODELVIEW = $1700;
201 GL_PROJECTION = $1701;
202 GL_TEXTURE = $1702;
204 (* Buffers, Pixel Drawing/Reading *)
205 GL_NONE = $0;
206 GL_LEFT = $0406;
207 GL_RIGHT = $0407;
208 (*GL_FRONT 0x0404 *)
209 (*GL_BACK 0x0405 *)
210 (*GL_FRONT_AND_BACK 0x0408 *)
211 GL_FRONT_LEFT = $0400;
212 GL_FRONT_RIGHT = $0401;
213 GL_BACK_LEFT = $0402;
214 GL_BACK_RIGHT = $0403;
215 GL_AUX0 = $0409;
216 GL_AUX1 = $040A;
217 GL_AUX2 = $040B;
218 GL_AUX3 = $040C;
219 GL_COLOR_INDEX = $1900;
220 GL_RED = $1903;
221 GL_GREEN = $1904;
222 GL_BLUE = $1905;
223 GL_ALPHA = $1906;
224 GL_LUMINANCE = $1909;
225 GL_LUMINANCE_ALPHA = $190A;
226 GL_ALPHA_BITS = $0D55;
227 GL_RED_BITS = $0D52;
228 GL_GREEN_BITS = $0D53;
229 GL_BLUE_BITS = $0D54;
230 GL_INDEX_BITS = $0D51;
231 // GL_SUBPIXEL_BITS = $0D50;
232 GL_AUX_BUFFERS = $0C00;
233 GL_READ_BUFFER = $0C02;
234 GL_DRAW_BUFFER = $0C01;
235 GL_DOUBLEBUFFER = $0C32;
236 GL_STEREO = $0C33;
237 GL_BITMAP = $1A00;
238 GL_COLOR = $1800;
239 GL_DEPTH = $1801;
240 GL_STENCIL = $1802;
241 GL_DITHER = $0BD0;
242 GL_RGB = $1907;
243 GL_RGBA = $1908;
245 (* Fog *)
246 GL_FOG = $0B60;
247 GL_FOG_MODE = $0B65;
248 GL_FOG_DENSITY = $0B62;
249 GL_FOG_COLOR = $0B66;
250 GL_FOG_INDEX = $0B61;
251 GL_FOG_START = $0B63;
252 GL_FOG_END = $0B64;
253 GL_LINEAR = $2601;
254 GL_EXP = $0800;
255 GL_EXP2 = $0801;
257 (* Polygons *)
258 GL_POINT = $1B00;
259 GL_LINE = $1B01;
260 GL_FILL = $1B02;
261 GL_CW = $0900;
262 GL_CCW = $0901;
263 GL_FRONT = $0404;
264 GL_BACK = $0405;
265 GL_POLYGON_MODE = $0B40;
266 GL_POLYGON_SMOOTH = $0B41;
267 GL_POLYGON_STIPPLE = $0B42;
268 GL_EDGE_FLAG = $0B43;
269 GL_CULL_FACE = $0B44;
270 GL_CULL_FACE_MODE = $0B45;
271 GL_FRONT_FACE = $0B46;
272 GL_POLYGON_OFFSET_FACTOR = $8038;
273 GL_POLYGON_OFFSET_UNITS = $2A00;
274 GL_POLYGON_OFFSET_POINT = $2A01;
275 GL_POLYGON_OFFSET_LINE = $2A02;
276 GL_POLYGON_OFFSET_FILL = $8037;
278 (* Lighting *)
279 GL_LIGHTING = $0B50;
280 GL_LIGHT0 = $4000;
281 GL_LIGHT1 = $4001;
282 GL_LIGHT2 = $4002;
283 GL_LIGHT3 = $4003;
284 GL_LIGHT4 = $4004;
285 GL_LIGHT5 = $4005;
286 GL_LIGHT6 = $4006;
287 GL_LIGHT7 = $4007;
288 GL_SPOT_EXPONENT = $1205;
289 GL_SPOT_CUTOFF = $1206;
290 GL_CONSTANT_ATTENUATION = $1207;
291 GL_LINEAR_ATTENUATION = $1208;
292 GL_QUADRATIC_ATTENUATION = $1209;
293 GL_AMBIENT = $1200;
294 GL_DIFFUSE = $1201;
295 GL_SPECULAR = $1202;
296 GL_SHININESS = $1601;
297 GL_EMISSION = $1600;
298 GL_POSITION = $1203;
299 GL_SPOT_DIRECTION = $1204;
300 GL_AMBIENT_AND_DIFFUSE = $1602;
301 GL_COLOR_INDEXES = $1603;
302 GL_LIGHT_MODEL_TWO_SIDE = $0B52;
303 GL_LIGHT_MODEL_LOCAL_VIEWER = $0B51;
304 GL_LIGHT_MODEL_AMBIENT = $0B53;
305 GL_FRONT_AND_BACK = $0408;
306 GL_SHADE_MODEL = $0B54;
307 GL_FLAT = $1D00;
308 GL_SMOOTH = $1D01;
309 GL_COLOR_MATERIAL = $0B57;
310 GL_COLOR_MATERIAL_FACE = $0B55;
311 GL_COLOR_MATERIAL_PARAMETER = $0B56;
312 GL_NORMALIZE = $0BA1;
314 (* Blending *)
315 GL_BLEND = $0BE2;
316 GL_BLEND_SRC = $0BE1;
317 GL_BLEND_DST = $0BE0;
318 GL_ZERO = $0;
319 GL_ONE = $1;
320 GL_SRC_COLOR = $0300;
321 GL_ONE_MINUS_SRC_COLOR = $0301;
322 GL_SRC_ALPHA = $0302;
323 GL_ONE_MINUS_SRC_ALPHA = $0303;
324 GL_DST_ALPHA = $0304;
325 GL_ONE_MINUS_DST_ALPHA = $0305;
326 GL_DST_COLOR = $0306;
327 GL_ONE_MINUS_DST_COLOR = $0307;
328 GL_SRC_ALPHA_SATURATE = $0308;
330 (* ClipPlaneName *)
331 GL_CLIP_PLANE0 = $3000;
332 GL_CLIP_PLANE1 = $3001;
333 GL_CLIP_PLANE2 = $3002;
334 GL_CLIP_PLANE3 = $3003;
335 GL_CLIP_PLANE4 = $3004;
336 GL_CLIP_PLANE5 = $3005;
338 (* OpenGL 1.1 *)
339 GL_PROXY_TEXTURE_1D = $8063;
340 GL_PROXY_TEXTURE_2D = $8064;
341 GL_TEXTURE_PRIORITY = $8066;
342 GL_TEXTURE_RESIDENT = $8067;
343 GL_TEXTURE_BINDING_1D = $8068;
344 GL_TEXTURE_BINDING_2D = $8069;
345 GL_TEXTURE_INTERNAL_FORMAT = $1003;
346 GL_ALPHA4 = $803B;
347 GL_ALPHA8 = $803C;
348 GL_ALPHA12 = $803D;
349 GL_ALPHA16 = $803E;
350 GL_LUMINANCE4 = $803F;
351 GL_LUMINANCE8 = $8040;
352 GL_LUMINANCE12 = $8041;
353 GL_LUMINANCE16 = $8042;
354 GL_LUMINANCE4_ALPHA4 = $8043;
355 GL_LUMINANCE6_ALPHA2 = $8044;
356 GL_LUMINANCE8_ALPHA8 = $8045;
357 GL_LUMINANCE12_ALPHA4 = $8046;
358 GL_LUMINANCE12_ALPHA12 = $8047;
359 GL_LUMINANCE16_ALPHA16 = $8048;
360 GL_INTENSITY = $8049;
361 GL_INTENSITY4 = $804A;
362 GL_INTENSITY8 = $804B;
363 GL_INTENSITY12 = $804C;
364 GL_INTENSITY16 = $804D;
365 GL_R3_G3_B2 = $2A10;
366 GL_RGB4 = $804F;
367 GL_RGB5 = $8050;
368 GL_RGB8 = $8051;
369 GL_RGB10 = $8052;
370 GL_RGB12 = $8053;
371 GL_RGB16 = $8054;
372 GL_RGBA2 = $8055;
373 GL_RGBA4 = $8056;
374 GL_RGB5_A1 = $8057;
375 GL_RGBA8 = $8058;
376 GL_RGB10_A2 = $8059;
377 GL_RGBA12 = $805A;
378 GL_RGBA16 = $805B;
379 GL_UNSIGNED_SHORT_4_4_4_4 = $8033;
380 GL_UNSIGNED_SHORT_5_5_5_1 = $8034;
381 GL_UNSIGNED_SHORT_5_6_5 = $8363;
383 GL_CLIENT_PIXEL_STORE_BIT = $00000001;
384 GL_CLIENT_VERTEX_ARRAY_BIT = $00000002;
385 GL_ALL_CLIENT_ATTRIB_BITS = $FFFFFFFF;
386 GL_CLIENT_ALL_ATTRIB_BITS = $FFFFFFFF;
388 (* Stencil *)
389 GL_STENCIL_TEST = $0B90;
390 GL_STENCIL_WRITEMASK = $0B98;
391 GL_STENCIL_BITS = $0D57;
392 GL_STENCIL_FUNC = $0B92;
393 GL_STENCIL_VALUE_MASK = $0B93;
394 GL_STENCIL_REF = $0B97;
395 GL_STENCIL_FAIL = $0B94;
396 GL_STENCIL_PASS_DEPTH_PASS = $0B96;
397 GL_STENCIL_PASS_DEPTH_FAIL = $0B95;
398 GL_STENCIL_CLEAR_VALUE = $0B91;
399 GL_STENCIL_INDEX = $1901;
400 GL_KEEP = $1E00;
401 GL_REPLACE = $1E01;
402 GL_INCR = $1E02;
403 GL_DECR = $1E03;
405 (* Hints *)
406 GL_FOG_HINT = $0C54;
407 GL_LINE_SMOOTH_HINT = $0C52;
408 GL_PERSPECTIVE_CORRECTION_HINT = $0C50;
409 GL_POINT_SMOOTH_HINT = $0C51;
410 GL_POLYGON_SMOOTH_HINT = $0C53;
411 GL_DONT_CARE = $1100;
412 GL_FASTEST = $1101;
413 GL_NICEST = $1102;
415 (* Gets *)
416 GL_ATTRIB_STACK_DEPTH = $0BB0;
417 GL_CLIENT_ATTRIB_STACK_DEPTH = $0BB1;
418 // GL_COLOR_CLEAR_VALUE = $0C22;
419 // GL_COLOR_WRITEMASK = $0C23;
420 GL_CURRENT_INDEX = $0B01;
421 // GL_CURRENT_COLOR = $0B00;
422 // GL_CURRENT_NORMAL = $0B02;
423 GL_CURRENT_RASTER_COLOR = $0B04;
424 GL_CURRENT_RASTER_DISTANCE = $0B09;
425 GL_CURRENT_RASTER_INDEX = $0B05;
426 GL_CURRENT_RASTER_POSITION = $0B07;
427 GL_CURRENT_RASTER_TEXTURE_COORDS = $0B06;
428 GL_CURRENT_RASTER_POSITION_VALID = $0B08;
429 // GL_CURRENT_TEXTURE_COORDS = $0B03;
430 GL_INDEX_CLEAR_VALUE = $0C20;
431 GL_INDEX_MODE = $0C30;
432 GL_INDEX_WRITEMASK = $0C21;
433 GL_MODELVIEW_MATRIX = $0BA6;
434 GL_MODELVIEW_STACK_DEPTH = $0BA3;
435 GL_NAME_STACK_DEPTH = $0D70;
436 GL_PROJECTION_MATRIX = $0BA7;
437 // GL_PROJECTION_STACK_DEPTH = $0BA4;
438 GL_RENDER_MODE = $0C40;
439 GL_RGBA_MODE = $0C31;
440 GL_TEXTURE_MATRIX = $0BA8;
441 // GL_TEXTURE_STACK_DEPTH = $0BA5;
442 GL_VIEWPORT = $0BA2;
444 (* glPush/PopAttrib bits *)
445 GL_CURRENT_BIT = $00000001;
446 GL_POINT_BIT = $00000002;
447 GL_LINE_BIT = $00000004;
448 GL_POLYGON_BIT = $00000008;
449 GL_POLYGON_STIPPLE_BIT = $00000010;
450 GL_PIXEL_MODE_BIT = $00000020;
451 GL_LIGHTING_BIT = $00000040;
452 GL_FOG_BIT = $00000080;
453 GL_DEPTH_BUFFER_BIT = $00000100;
454 GL_ACCUM_BUFFER_BIT = $00000200;
455 GL_STENCIL_BUFFER_BIT = $00000400;
456 GL_VIEWPORT_BIT = $00000800;
457 GL_TRANSFORM_BIT = $00001000;
458 GL_ENABLE_BIT = $00002000;
459 GL_COLOR_BUFFER_BIT = $00004000;
460 GL_HINT_BIT = $00008000;
461 GL_EVAL_BIT = $00010000;
462 GL_LIST_BIT = $00020000;
463 GL_TEXTURE_BIT = $00040000;
464 GL_SCISSOR_BIT = $00080000;
465 GL_ALL_ATTRIB_BITS = $000FFFFF;
467 (* Depth buffer *)
468 GL_NEVER = $0200;
469 GL_LESS = $0201;
470 GL_EQUAL = $0202;
471 GL_LEQUAL = $0203;
472 GL_GREATER = $0204;
473 GL_NOTEQUAL = $0205;
474 GL_GEQUAL = $0206;
475 GL_ALWAYS = $0207;
476 GL_DEPTH_TEST = $0B71;
477 GL_DEPTH_BITS = $0D56;
478 GL_DEPTH_CLEAR_VALUE = $0B73;
479 GL_DEPTH_FUNC = $0B74;
480 GL_DEPTH_RANGE = $0B70;
481 GL_DEPTH_WRITEMASK = $0B72;
482 GL_DEPTH_COMPONENT = $1902;
484 (* TextureUnit *)
485 GL_TEXTURE0 = $84C0;
486 GL_TEXTURE1 = $84C1;
487 GL_TEXTURE2 = $84C2;
488 GL_TEXTURE3 = $84C3;
489 GL_TEXTURE4 = $84C4;
490 GL_TEXTURE5 = $84C5;
491 GL_TEXTURE6 = $84C6;
492 GL_TEXTURE7 = $84C7;
493 GL_TEXTURE8 = $84C8;
494 GL_TEXTURE9 = $84C9;
495 GL_TEXTURE10 = $84CA;
496 GL_TEXTURE11 = $84CB;
497 GL_TEXTURE12 = $84CC;
498 GL_TEXTURE13 = $84CD;
499 GL_TEXTURE14 = $84CE;
500 GL_TEXTURE15 = $84CF;
501 GL_TEXTURE16 = $84D0;
502 GL_TEXTURE17 = $84D1;
503 GL_TEXTURE18 = $84D2;
504 GL_TEXTURE19 = $84D3;
505 GL_TEXTURE20 = $84D4;
506 GL_TEXTURE21 = $84D5;
507 GL_TEXTURE22 = $84D6;
508 GL_TEXTURE23 = $84D7;
509 GL_TEXTURE24 = $84D8;
510 GL_TEXTURE25 = $84D9;
511 GL_TEXTURE26 = $84DA;
512 GL_TEXTURE27 = $84DB;
513 GL_TEXTURE28 = $84DC;
514 GL_TEXTURE29 = $84DD;
515 GL_TEXTURE30 = $84DE;
516 GL_TEXTURE31 = $84DF;
517 GL_ACTIVE_TEXTURE = $84E0;
518 GL_CLIENT_ACTIVE_TEXTURE = $84E1;
520 (* GetPName *)
521 GL_CURRENT_COLOR = $0B00;
522 GL_CURRENT_NORMAL = $0B02;
523 GL_CURRENT_TEXTURE_COORDS = $0B03;
524 GL_POINT_SIZE = $0B11;
525 GL_POINT_SIZE_MIN = $8126;
526 GL_POINT_SIZE_MAX = $8127;
527 GL_POINT_FADE_THRESHOLD_SIZE = $8128;
528 GL_POINT_DISTANCE_ATTENUATION = $8129;
529 GL_SMOOTH_POINT_SIZE_RANGE = $0B12;
530 GL_LINE_WIDTH = $0B21;
531 GL_SMOOTH_LINE_WIDTH_RANGE = $0B22;
532 GL_ALIASED_POINT_SIZE_RANGE = $846D;
533 GL_ALIASED_LINE_WIDTH_RANGE = $846E;
534 // GL_CULL_FACE_MODE = $0B45;
535 // GL_FRONT_FACE = $0B46;
536 // GL_SHADE_MODEL = $0B54;
537 // GL_DEPTH_RANGE = $0B70;
538 // GL_DEPTH_WRITEMASK = $0B72;
539 // GL_DEPTH_CLEAR_VALUE = $0B73;
540 // GL_DEPTH_FUNC = $0B74;
541 // GL_STENCIL_CLEAR_VALUE = $0B91;
542 // GL_STENCIL_FUNC = $0B92;
543 // GL_STENCIL_VALUE_MASK = $0B93;
544 // GL_STENCIL_FAIL = $0B94;
545 // GL_STENCIL_PASS_DEPTH_FAIL = $0B95;
546 // GL_STENCIL_PASS_DEPTH_PASS = $0B96;
547 // GL_STENCIL_REF = $0B97;
548 // GL_STENCIL_WRITEMASK = $0B98;
549 // GL_MATRIX_MODE = $0BA0;
550 // GL_VIEWPORT = $0BA2;
551 // GL_MODELVIEW_STACK_DEPTH = $0BA3;
552 GL_PROJECTION_STACK_DEPTH = $0BA4;
553 GL_TEXTURE_STACK_DEPTH = $0BA5;
554 // GL_MODELVIEW_MATRIX = $0BA6;
555 // GL_PROJECTION_MATRIX = $0BA7;
556 // GL_TEXTURE_MATRIX = $0BA8;
557 GL_ALPHA_TEST_FUNC = $0BC1;
558 GL_ALPHA_TEST_REF = $0BC2;
559 // GL_BLEND_DST = $0BE0;
560 // GL_BLEND_SRC = $0BE1;
561 GL_LOGIC_OP_MODE = $0BF0;
562 GL_SCISSOR_BOX = $0C10;
563 // GL_SCISSOR_TEST = $0C11;
564 GL_COLOR_CLEAR_VALUE = $0C22;
565 GL_COLOR_WRITEMASK = $0C23;
566 GL_UNPACK_ALIGNMENT = $0CF5;
567 GL_PACK_ALIGNMENT = $0D05;
568 GL_MAX_LIGHTS = $0D31;
569 GL_MAX_CLIP_PLANES = $0D32;
570 GL_MAX_TEXTURE_SIZE = $0D33;
571 GL_MAX_MODELVIEW_STACK_DEPTH = $0D36;
572 GL_MAX_PROJECTION_STACK_DEPTH = $0D38;
573 GL_MAX_TEXTURE_STACK_DEPTH = $0D39;
574 GL_MAX_VIEWPORT_DIMS = $0D3A;
575 GL_MAX_ELEMENTS_VERTICES = $80E8;
576 GL_MAX_ELEMENTS_INDICES = $80E9;
577 GL_MAX_TEXTURE_UNITS = $84E2;
578 GL_SUBPIXEL_BITS = $0D50;
579 // GL_RED_BITS = $0D52;
580 // GL_GREEN_BITS = $0D53;
581 // GL_BLUE_BITS = $0D54;
582 // GL_ALPHA_BITS = $0D55;
583 // GL_DEPTH_BITS = $0D56;
584 // GL_STENCIL_BITS = $0D57;
585 // GL_POLYGON_OFFSET_UNITS = $2A00;
586 // GL_POLYGON_OFFSET_FILL = $8037;
587 // GL_POLYGON_OFFSET_FACTOR = $8038;
588 // GL_TEXTURE_BINDING_2D = $8069;
589 GL_VERTEX_ARRAY_SIZE = $807A;
590 GL_VERTEX_ARRAY_TYPE = $807B;
591 GL_VERTEX_ARRAY_STRIDE = $807C;
592 GL_NORMAL_ARRAY_TYPE = $807E;
593 GL_NORMAL_ARRAY_STRIDE = $807F;
594 GL_COLOR_ARRAY_SIZE = $8081;
595 GL_COLOR_ARRAY_TYPE = $8082;
596 GL_COLOR_ARRAY_STRIDE = $8083;
597 GL_TEXTURE_COORD_ARRAY_SIZE = $8088;
598 GL_TEXTURE_COORD_ARRAY_TYPE = $8089;
599 GL_TEXTURE_COORD_ARRAY_STRIDE = $808A;
600 GL_VERTEX_ARRAY_POINTER = $808E;
601 GL_NORMAL_ARRAY_POINTER = $808F;
602 GL_COLOR_ARRAY_POINTER = $8090;
603 GL_TEXTURE_COORD_ARRAY_POINTER = $8092;
604 GL_SAMPLE_BUFFERS = $80A8;
605 GL_SAMPLES = $80A9;
606 GL_SAMPLE_COVERAGE_VALUE = $80AA;
607 GL_SAMPLE_COVERAGE_INVERT = $80AB;
609 (* ErrorCode *)
610 GL_NO_ERROR = 0;
611 GL_INVALID_ENUM = $0500;
612 GL_INVALID_VALUE = $0501;
613 GL_INVALID_OPERATION = $0502;
614 GL_STACK_OVERFLOW = $0503;
615 GL_STACK_UNDERFLOW = $0504;
616 GL_OUT_OF_MEMORY = $0505;
618 (* Macros *)
619 procedure glVertex2i(x, y: GLint);
620 procedure glTexCoord2d(s, t: GLdouble);
621 procedure glVertex3d(x, y, z: GLdouble);
623 (* This Port Specific *)
624 procedure glLoadMatrixd(const m: PGLdouble);
625 procedure glTexCoord2i(s, t: GLint);
627 procedure glBegin(mode: GLenum); cdecl; external nanoGL_LibName;
628 procedure glEnd; cdecl; external nanoGL_LibName;
629 procedure glEnable(cap: GLenum); cdecl; external nanoGL_LibName;
630 procedure glDisable(cap: GLenum); cdecl; external nanoGL_LibName;
631 procedure glVertex2f(x, y: GLfloat); cdecl; external nanoGL_LibName;
632 procedure glColor3f(red, green, blue: GLfloat); cdecl; external nanoGL_LibName;
633 procedure glTexCoord2f(s, t: GLfloat); cdecl; external nanoGL_LibName;
634 procedure glViewport(x, y: GLint; width, height: GLsizei); cdecl; external nanoGL_LibName;
635 procedure glLoadIdentity; cdecl; external nanoGL_LibName;
636 procedure glColor4f(red, green, blue, alpha: GLfloat); cdecl; external nanoGL_LibName;
637 procedure glOrtho(left, right, bottom, top, zNear, zFar: GLdouble); cdecl; external nanoGL_LibName;
638 procedure glMatrixMode(mode: GLenum); cdecl; external nanoGL_LibName;
639 //procedure glTexParameterf(target: GLenum; pname: GLenum; param: GLfloat); cdecl; external nanoGL_LibName;
640 procedure glTexImage2D(target: GLenum; level, internalformat: GLint; width, height: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); cdecl; external nanoGL_LibName;
641 procedure glDrawBuffer(mode: GLenum); cdecl; external nanoGL_LibName;
642 procedure glTranslatef(x, y, z: GLfloat); cdecl; external nanoGL_LibName;
643 procedure glRotatef(angle, x, y, z: GLfloat); cdecl; external nanoGL_LibName;
644 procedure glScalef(x, y, z: GLfloat); cdecl; external nanoGL_LibName;
645 procedure glDepthRange(zNear, zFar: GLclampd); cdecl; external nanoGL_LibName;
646 procedure glDepthFunc(func: GLenum); cdecl; external nanoGL_LibName;
647 procedure glFinish; cdecl; external nanoGL_LibName;
648 procedure glGetFloatv(pname: GLenum; params: PGLfloat); cdecl; external nanoGL_LibName;
649 procedure glGetIntegerv(pname: GLenum; params: PGLint); cdecl; external nanoGL_LibName;
650 procedure glCullFace(mode: GLenum); cdecl; external nanoGL_LibName;
651 procedure glFrustum(left, right, bottom, top, zNear, zFar: GLdouble); cdecl; external nanoGL_LibName;
652 procedure glClear(mask: GLbitfield); cdecl; external nanoGL_LibName;
653 procedure glVertex3f(x, y, z: GLfloat); cdecl; external nanoGL_LibName;
654 procedure glColor4fv(const v: PGLfloat); cdecl; external nanoGL_LibName;
655 procedure glHint(target, mode: GLenum); cdecl; external nanoGL_LibName;
656 procedure glBlendFunc(sfactor, dfactor: GLenum); cdecl; external nanoGL_LibName;
657 procedure glPopMatrix; cdecl; external nanoGL_LibName;
658 procedure glShadeModel(mode: GLenum); cdecl; external nanoGL_LibName;
659 procedure glPushMatrix; cdecl; external nanoGL_LibName;
660 procedure glTexEnvf(target: GLenum; pname: GLenum; param: GLfloat); cdecl; external nanoGL_LibName;
661 procedure glVertex3fv(const v: PGLfloat); cdecl; external nanoGL_LibName;
662 procedure glDepthMask(flag: GLboolean); cdecl; external nanoGL_LibName;
663 procedure glBindTexture(target: GLenum; texture: GLuint); cdecl; external nanoGL_LibName;
664 function glGetString(name: GLenum): PChar; cdecl; external nanoGL_LibName; // originally returns PGLubyte
665 procedure glAlphaFunc(func: GLenum; ref: GLclampf); cdecl; external nanoGL_LibName;
666 procedure glFlush; cdecl; external nanoGL_LibName;
667 procedure glReadPixels(x, y: GLint; width, height: GLsizei; format, atype: GLenum; pixels: Pointer); cdecl; external nanoGL_LibName;
668 procedure glReadBuffer(mode: GLenum); cdecl; external nanoGL_LibName;
669 procedure glLoadMatrixf(const m: PGLfloat); cdecl; external nanoGL_LibName;
670 procedure glTexSubImage2D(target: GLenum; level, xoffset, yoffset: GLint; width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); cdecl; external nanoGL_LibName;
671 procedure glClearColor(red, green, blue, alpha: GLclampf); cdecl; external nanoGL_LibName;
672 function glGetError(): GLenum; cdecl; external nanoGL_LibName;
673 procedure glActiveTexture(texture: GLenum); cdecl; external nanoGL_LibName;
674 procedure glClientActiveTexture(texture: GLenum); cdecl; external nanoGL_LibName;
675 procedure glActiveTextureARB(texture: GLenum); cdecl; external nanoGL_LibName;
676 procedure glClientActiveTextureARB(texture: GLenum); cdecl; external nanoGL_LibName;
677 procedure glColor3ubv(const v: PGLubyte); cdecl; external nanoGL_LibName;
678 procedure glPolygonMode(face, mode: GLenum); cdecl; external nanoGL_LibName;
679 procedure glArrayElement(i: GLint); cdecl; external nanoGL_LibName;
680 procedure glLineWidth(width: GLfloat); cdecl; external nanoGL_LibName;
681 procedure glCallList(list: GLuint); cdecl; external nanoGL_LibName;
682 procedure glTexCoord2fv(const v: PGLfloat); cdecl; external nanoGL_LibName;
683 procedure glColorMask(red, green, blue, alpha: GLboolean); cdecl; external nanoGL_LibName;
684 procedure glStencilFunc(func: GLenum; ref: GLint; mask: GLuint); cdecl; external nanoGL_LibName;
685 procedure glStencilOp(fail, zfail, zpass: GLenum); cdecl; external nanoGL_LibName;
686 procedure glColor4ubv(const v: PGLubyte); cdecl; external nanoGL_LibName;
687 procedure glDrawElements(mode: GLenum; count: GLsizei; atype: GLenum; const indices: Pointer); cdecl; external nanoGL_LibName;
688 procedure glEnableClientState(aarray: GLenum); cdecl; external nanoGL_LibName;
689 procedure glDisableClientState(aarray: GLenum); cdecl; external nanoGL_LibName;
690 procedure glVertexPointer(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); cdecl; external nanoGL_LibName;
691 procedure glTexCoordPointer(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); cdecl; external nanoGL_LibName;
692 procedure glColorPointer(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); cdecl; external nanoGL_LibName;
693 procedure glPolygonOffset(factor, units: GLfloat); cdecl; external nanoGL_LibName;
694 procedure glClearDepth(depth: GLclampd); cdecl; external nanoGL_LibName;
695 procedure glDeleteTextures(n: GLsizei; const textures: PGLuint); cdecl; external nanoGL_LibName;
696 procedure glTexParameterfv(target: GLenum; pname: GLenum; const params: PGLfloat); cdecl; external nanoGL_LibName;
697 procedure glStencilMask(mask: GLuint); cdecl; external nanoGL_LibName;
698 procedure glClearStencil(s: GLint); cdecl; external nanoGL_LibName;
699 procedure glScissor(x, y: GLint; width, height: GLsizei); cdecl; external nanoGL_LibName;
700 procedure glClipPlane(plane: GLenum; const equation: PGLdouble); cdecl; external nanoGL_LibName;
701 procedure glColor3fv(const v: PGLfloat); cdecl; external nanoGL_LibName;
702 procedure glPointSize(size: GLfloat); cdecl; external nanoGL_LibName;
703 //procedure glDrawArrays(mode: GLenum; first: GLint; count: GLsizei); cdecl; external nanoGL_LibName;
704 procedure glMultMatrixf(const m: PGLfloat); cdecl; external nanoGL_LibName;
705 procedure glPixelStorei(pname: GLenum; param: GLint); cdecl; external nanoGL_LibName;
706 procedure glFogi(pname: GLenum; param: GLint); cdecl; external nanoGL_LibName;
707 procedure glFogf(pname: GLenum; param: GLfloat); cdecl; external nanoGL_LibName;
708 procedure glFogfv(pname: GLenum; const params: PGLfloat); cdecl; external nanoGL_LibName;
709 procedure glGetTexParameteriv(target, pname: GLenum; params: PGLint); cdecl; external nanoGL_LibName;
710 procedure glTexParameteri(target: GLenum; pname: GLenum; param: GLint); cdecl; external nanoGL_LibName;
711 procedure glTexParameterf(target: GLenum; pname: GLenum; param: GLfloat); cdecl; external nanoGL_LibName;
712 procedure glTexParameterx(target: GLenum; pname: GLenum; param: GLfixed); cdecl; external nanoGL_LibName;
713 procedure glGenTextures(n: GLsizei; textures: PGLuint); cdecl; external nanoGL_LibName;
714 procedure glFrontFace(mode: GLenum); cdecl; external nanoGL_LibName;
715 procedure glLightf(light, pname: GLenum; param: GLfloat); cdecl; external nanoGL_LibName;
716 procedure glLightfv(light, pname: GLenum; const params: PGLfloat); cdecl; external nanoGL_LibName;
717 procedure glLightModelf(pname: GLenum; param: GLfloat); cdecl; external nanoGL_LibName;
718 procedure glLightModelfv(pname: GLenum; const params: PGLfloat); cdecl; external nanoGL_LibName;
719 procedure glMaterialf(face, pname: GLenum; param: GLfloat); cdecl; external nanoGL_LibName;
720 procedure glMaterialfv(face, pname: GLenum; const params: PGLfloat); cdecl; external nanoGL_LibName;
721 procedure glColorMaterial(face, mode: GLenum); cdecl; external nanoGL_LibName;
722 procedure glColor3ub(red, green, blue: GLubyte); cdecl; external nanoGL_LibName;
723 procedure glNormal3fv(const v: PGLfloat); cdecl; external nanoGL_LibName;
724 procedure glCopyTexImage2D(target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width, height: GLsizei; border: GLint); cdecl; external nanoGL_LibName;
725 procedure glTexImage1D(target: GLenum; level: GLInt; internalformat: GLEnum; width: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); cdecl; external nanoGL_LibName;
726 procedure glTexImage3D(target: GLenum; level: GLint; internalformat: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; border: GLint; format: GLenum; _type: GLenum; const pixels: PGLvoid); cdecl; external nanoGL_LibName;
727 procedure glTexSubImage1D(target: GLenum; level, xoffset: GLint; width: GLsizei; format, atype: GLenum; const pixels: Pointer); cdecl; external nanoGL_LibName;
728 procedure glTexSubImage3D(target: GLenum; level: GLint; xoffset: GLint; yoffset: GLint; zoffset: GLint; width: GLsizei; height: GLsizei; depth: GLsizei; format: GLenum; _type: GLenum; const pixels: PGLvoid); cdecl; external nanoGL_LibName;
729 function glIsTexture(texture: GLuint): GLboolean; cdecl; external nanoGL_LibName;
730 procedure glTexGeni(coord: GLenum; pname: GLenum; param: GLint); cdecl; external nanoGL_LibName;
731 procedure glTexGenfv(coord: GLenum; pname: GLenum; const params: PGLfloat); cdecl; external nanoGL_LibName;
732 procedure glColor4ub(red, green, blue, alpha: GLubyte); cdecl; external nanoGL_LibName;
733 procedure glCopyTexSubImage2D(target: GLenum; level, xoffset, yoffset, x, y: GLint; width, height: GLsizei); cdecl; external nanoGL_LibName;
734 procedure glTexEnvi(target: GLenum; pname: GLenum; param: GLint); cdecl; external nanoGL_LibName;
735 procedure glBindFramebuffer(target: GLenum; framebuffer: GLuint); cdecl; external nanoGL_LibName;
736 procedure glDeleteFramebuffers(n: GLsizei; const framebuffers: PGLuint); cdecl; external nanoGL_LibName;
737 procedure glGenFramebuffers(n: GLsizei; framebuffers: PGLuint); cdecl; external nanoGL_LibName;
738 function glCheckFramebufferStatus(target: GLenum): GLenum; cdecl; external nanoGL_LibName;
739 function glIsRenderbuffer(renderbuffer: GLuint): GLboolean; cdecl; external nanoGL_LibName;
740 procedure glBindRenderbuffer(target: GLenum; renderbuffer: GLuint); cdecl; external nanoGL_LibName;
741 procedure glDeleteRenderbuffers(n: GLsizei; const renderbuffers: PGLuint); cdecl; external nanoGL_LibName;
742 procedure glGenRenderbuffers(n: GLsizei; renderbuffers: PGLuint); cdecl; external nanoGL_LibName;
743 procedure glRenderbufferStorage(target: GLenum; internalformat: GLenum; width: GLsizei; height: GLsizei); cdecl; external nanoGL_LibName;
744 procedure glFramebufferTexture2D(target: GLenum; attachment: GLenum; textarget: GLenum; texture: GLuint; level: GLint); cdecl; external nanoGL_LibName;
745 procedure glFramebufferRenderbuffer(target: GLenum; attachment: GLenum; renderbuffertarget: GLenum; renderbuffer: GLuint); cdecl; external nanoGL_LibName;
746 procedure glNormalPointer(atype: GLenum; stride: GLsizei; const pointer: Pointer); cdecl; external nanoGL_LibName;
747 procedure glMultiTexCoord3f(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat); cdecl; external nanoGL_LibName;
748 procedure glMultiTexCoord3fARB(target: GLenum; s: GLfloat; t: GLfloat; r: GLfloat); cdecl; external nanoGL_LibName;
749 procedure glMultiTexCoord2f(target: GLenum; s: GLfloat; t: GLfloat); cdecl; external nanoGL_LibName;
750 procedure glDrawArrays(mode: GLenum; first: GLint; count: GLsizei); cdecl; external nanoGL_LibName;
751 procedure glBindBufferARB(target: GLuint; index: GLuint); cdecl; external nanoGL_LibName;
752 procedure glGenBuffersARB(count: Gluint; indexes: PGLuint); cdecl; external nanoGL_LibName;
753 procedure glDeleteBuffersARB(count: GLuint; indexes: PGLuint); cdecl; external nanoGL_LibName;
754 procedure glBufferDataARB(target: GLuint; size: GLuint; buffer: PGLvoid; _type: GLuint); cdecl; external nanoGL_LibName;
755 procedure glBufferSubDataARB(target: GLuint; offset: GLsizei; size: GLsizei; buffer: PGLvoid); cdecl; external nanoGL_LibName;
757 function nanoGL_Init(): CInt; cdecl; external nanoGL_LibName;
758 procedure nanoGL_Destroy; cdecl; external nanoGL_LibName;
759 procedure nanoGL_Flush; cdecl; external nanoGL_LibName;
760 function nanoGL_GetProcAddress(name: PAnsiChar): Pointer; cdecl; external nanoGL_LibName;
761 procedure nanoGL_Reset; cdecl; external nanoGL_LibName;
763 implementation
765 procedure glVertex2i(x, y: GLint);
766 begin
767 glVertex3f(x, y, 0);
768 end;
770 procedure glTexCoord2d(s, t: GLdouble);
771 begin
772 glTexCoord2f(s, t);
773 end;
775 procedure glVertex3d(x, y, z: GLdouble);
776 begin
777 glVertex3f(x, y, z);
778 end;
780 (**** ****)
782 procedure glLoadMatrixd(const m: PGLdouble);
783 var
784 i: Integer;
785 n: array [0..15] of GLfloat;
786 begin
787 for i := 0 to 15 do
788 n[i] := m[i];
789 glLoadMatrixf(@n[0]);
790 end;
792 procedure glTexCoord2i(s, t: GLint);
793 begin
794 glTexCoord2f(1 / s, 1 / t);
795 end;
797 end.