DEADSOFTWARE

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