-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrlgl.nelua
567 lines (483 loc) · 33 KB
/
rlgl.nelua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
require 'raylib'
##[[ cinclude "rlgl.h" ]]
--[[
RLGL.nelua is a binding to Raylibs core RLGL. It is not created to be used for standalone purposes. RLGL.nelua relies on Raylib.nelua
]]
global rlgl = @record{}
-- Texture parameters (equivalent to OpenGL defines)
global rlgl.TEXTURE_WRAP_S <const> = 0x2802
global rlgl.TEXTURE_WRAP_T <const> = 0x2803
global rlgl.TEXTURE_MAG_FILTER <const> = 0x2800
global rlgl.TEXTURE_MIN_FILTER <const> = 0x2801
global rlgl.TEXTURE_FILTER_NEAREST <const> = 0x2600
global rlgl.TEXTURE_FILTER_LINEAR <const> = 0x2601
global rlgl.TEXTURE_FILTER_MIP_NEAREST <const> = 0x2700
global rlgl.TEXTURE_FILTER_NEAREST_MIP_LINEAR <const> = 0x2702
global rlgl.TEXTURE_FILTER_LINEAR_MIP_NEAREST <const> = 0x2701
global rlgl.TEXTURE_FILTER_MIP_LINEAR <const> = 0x2703
global rlgl.TEXTURE_FILTER_ANISOTROPIC <const> = 0x3000
global rlgl.TEXTURE_MIPMAP_BIAS_RATIO <const> = 0x4000
global rlgl.TEXTURE_WRAP_REPEAT <const> = 0x2901
global rlgl.TEXTURE_WRAP_CLAMP <const> = 0x812F
global rlgl.TEXTURE_WRAP_MIRROR_REPEAT <const> = 0x8370
global rlgl.TEXTURE_WRAP_MIRROR_CLAMP <const> = 0x8742
--------------------------------------------------------------------------------------------------------------------------
-- Matrix modes (equivalent to OpenGL)
global rlgl.MODELVIEW <const> = 0x1700
global rlgl.PROJECTION <const> = 0x1701
global rlgl.TEXTURE <const> = 0x1702
--------------------------------------------------------------------------------------------------------------------------
-- Primitive assembly draw modes
global rlgl.LINES <const> = 0x0001
global rlgl.TRIANGLES <const> = 0x0004
global rlgl.QUADS <const> = 0x0007
--------------------------------------------------------------------------------------------------------------------------
-- GL equivalent data types
global rlgl.UNSIGNED_BYTE <const> = 0x1401
global rlgl.FLOAT <const> = 0x1406
--------------------------------------------------------------------------------------------------------------------------
-- Buffer usage hint
global rlgl.STREAM_DRAW <const> = 0x88E0
global rlgl.STREAM_READ <const> = 0x88E1
global rlgl.STREAM_COPY <const> = 0x88E2
global rlgl.STATIC_DRAW <const> = 0x88E4
global rlgl.STATIC_READ <const> = 0x88E5
global rlgl.STATIC_COPY <const> = 0x88E6
global rlgl.DYNAMIC_DRAW <const> = 0x88E8
global rlgl.DYNAMIC_READ <const> = 0x88E9
global rlgl.DYNAMIC_COPY <const> = 0x88EA
--------------------------------------------------------------------------------------------------------------------------
-- GL Shader type
global rlgl.FRAGMENT_SHADER <const> = 0x8B30
global rlgl.VERTEX_SHADER <const> = 0x8B31
global rlgl.COMPUTE_SHADER <const> = 0x91B9
--------------------------------------------------------------------------------------------------------------------------
-- GL blending factors
global rlgl.ZERO <const> = 0
global rlgl.ONE <const> = 1
global rlgl.SRC_COLOR <const> = 0x0300
global rlgl.ONE_MINUS_SRC_COLOR <const> = 0x0301
global rlgl.SRC_ALPHA <const> = 0x0302
global rlgl.ONE_MINUS_SRC_ALPHA <const> = 0x0303
global rlgl.DST_ALPHA <const> = 0x0304
global rlgl.ONE_MINUS_DST_ALPHA <const> = 0x0305
global rlgl.DST_COLOR <const> = 0x0306
global rlgl.ONE_MINUS_DST_COLOR <const> = 0x0307
global rlgl.SRC_ALPHA_SATURATE <const> = 0x0308
global rlgl.CONSTANT_COLOR <const> = 0x8001
global rlgl.ONE_MINUS_CONSTANT_COLOR <const> = 0x8002
global rlgl.CONSTANT_ALPHA <const> = 0x8003
global rlgl.ONE_MINUS_CONSTANT_ALPHA <const> = 0x8004
--------------------------------------------------------------------------------------------------------------------------
-- GL blending functions/equations
global rlgl.FUNC_ADD <const> = 0x8006
global rlgl.MIN <const> = 0x8007
global rlgl.MAX <const> = 0x8008
global rlgl.FUNC_SUBTRACT <const> = 0x800A
global rlgl.FUNC_REVERSE_SUBTRACT <const> = 0x800B
global rlgl.BLEND_EQUATION <const> = 0x8009
global rlgl.BLEND_EQUATION_RGB <const> = 0x8009
global rlgl.BLEND_EQUATION_ALPHA <const> = 0x883D
global rlgl.BLEND_DST_RGB <const> = 0x80C8
global rlgl.BLEND_SRC_RGB <const> = 0x80C9
global rlgl.BLEND_DST_ALPHA <const> = 0x80CA
global rlgl.BLEND_SRC_ALPHA <const> = 0x80CB
global rlgl.BLEND_COLOR <const> = 0x8005
global rlgl.READ_FRAMEBUFFER <const> = 0x8CA8
global rlgl.DRAW_FRAMEBUFFER <const> = 0x8CA9
global rlgl.DEFAULT_SHADER_ATTRIB_LOCATION_POSITION <const> = 0
global rlgl.DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD <const> = 1
global rlgl.DEFAULT_SHADER_ATTRIB_LOCATION_NORMAL <const> = 2
global rlgl.DEFAULT_SHADER_ATTRIB_LOCATION_COLOR <const> = 3
global rlgl.DEFAULT_SHADER_ATTRIB_LOCATION_TANGENT <const> = 4
global rlgl.DEFAULT_SHADER_ATTRIB_LOCATION_TEXCOORD2 <const> = 5
global rlgl.DEFAULT_SHADER_ATTRIB_LOCATION_INDICES <const> = 6
global rlgl.DEFAULT_SHADER_ATTRIB_LOCATION_BONEIDS <const> = 7
global rlgl.DEFAULT_SHADER_ATTRIB_LOCATION_BONEWEIGHTS <const> = 8
--------------------------------------------------------------------------------------------------------------------------
-- Dynamic vertex buffers (position + texcoords + colors + indices arrays)
global rlgl.vertexBuffer: type <cimport'rlVertexBuffer', cinclude'<rlgl.h>',nodecl> = @record{
elementCount: float32,
vertices: *float32,
texcoords: *float32,
normals: *float32,
colors: *cuchar,
indencies: *cuint,
vaoId: cuint,
vboId: [5]cuint
}
--------------------------------------------------------------------------------------------------------------------------
--[[ rlDrawCall - Draw call type
NOTE: Only texture changes register a new draw, other state-change-related elements are not
used at this moment (vaoId, shaderId, matrices), raylib just forces a batch draw call if any
of those state-change happens (this is done in core module) ]]
global rlgl.drawCall: type <cimport'rlDrawCall', cinclude'<rlgl.h>',nodecl> = @record{
mode: cint,
vertexCount: cint,
vertexAlignment: cint,
textureId: cuint
}
--------------------------------------------------------------------------------------------------------------------------
-- rlRenderBatch type
global rlgl.renderBatch: type <cimport'rlRenderBatch', cinclude'<rlgl.h>',nodecl> = @record{
bufferCount: cint,
currentBuffer: cint,
vertexBuffer: [0]rlgl.vertexBuffer,
draws: [0]rlgl.drawCall,
drawCounter: cint,
currentDepth: float32
}
--------------------------------------------------------------------------------------------------------------------------
global rlgl.glVersion: type <cimport'rlGlVersion', cinclude'<rlgl.h>',nodecl,using> = @enum(cint){
OPENGL_11 = 1,
OPENGL_21,
OPENGL_33,
OPENGL_43,
OPENGL_ES_20,
OPENGL_ES_30
}
--------------------------------------------------------------------------------------------------------------------------
global rlgl.framebufferAttachType: type <cimport'rlFramebufferAttachType', cinclude'<rlgl.h>',nodecl,using> = @enum(cint){
COLOR_CHANNEL0 = 0,
COLOR_CHANNEL1,
COLOR_CHANNEL2,
COLOR_CHANNEL3,
COLOR_CHANNEL4,
COLOR_CHANNEL5,
COLOR_CHANNEL6,
COLOR_CHANNEL7,
DEPTH = 100,
STENCIL = 200,
}
--------------------------------------------------------------------------------------------------------------------------
global rlgl.framebufferAttachTextureType: type <cimport'rlFramebufferAttachTextureType', cinclude'<rlgl.h>',nodecl,using> = @enum(cint){
CUBEMAP_POSITIVE_X = 0,
CUBEMAP_NEGATIVE_X,
CUBEMAP_POSITIVE_Y,
CUBEMAP_NEGATIVE_Y,
CUBEMAP_POSITIVE_Z,
CUBEMAP_NEGATIVE_Z,
TEXTURE2D = 100,
RENDERBUFFER = 200
}
--------------------------------------------------------------------------------------------------------------------------
global rlgl.cullMode: type <cimport'rlCullMode', cinclude'<rlgl.h>',nodecl,using> = @enum(cint){
FACE_FRONT = 0,
FACE_BACK
}
--------------------------------------------------------------------------------------------------------------------------
global rlgl.shaderUniformDataType: type <cimport'rlShaderUniformDataType', cinclude'<rlgl.h>',nodecl,using> = @enum(cint){
FLOAT = 0,
VEC2 = 1,
VEC3 = 2,
VEC4 = 3,
INT = 4,
IVEC2 = 5,
IVEC3 = 6,
IVEC4 = 7,
UINT = 8,
UIVEC2 = 9,
UIVEC3 = 10,
UIVEC4 = 11,
SAMPLER2D = 12
}
--------------------------------------------------------------------------------------------------------------------------
global rlgl.traceLogLevel: type <cimport'rlTraceLogLevel', cinclude'<rlgl.h>',nodecl,using> = @enum(cint){
ALL = 0,
TRACE = 1,
DEBUG = 2,
INFO = 3,
WARNING = 4,
ERROR = 5,
FATAL = 6,
NONE = 7
}
--------------------------------------------------------------------------------------------------------------------------
global rlgl.shaderUniformDataType: type <cimport'rlPixelFormat', cinclude'<rlgl.h>',nodecl,using> = @enum(cint){
UNCOMPRESSED_GRAYSCALE = 1,
UNCOMPRESSED_GRAY_ALPHA = 2,
UNCOMPRESSED_R5G6B5 = 3,
UNCOMPRESSED_R8G8B8 = 4,
UNCOMPRESSED_R5G5B5A1 = 5,
UNCOMPRESSED_R4G4B4A4 = 6,
UNCOMPRESSED_R8G8B8A8 = 7,
UNCOMPRESSED_R32 = 8,
UNCOMPRESSED_R32G32B32 = 9,
UNCOMPRESSED_R32G32B32A32 = 10,
UNCOMPRESSED_R16 = 11,
UNCOMPRESSED_R16G16B16 = 12,
UNCOMPRESSED_R16G16B16A16 = 13,
COMPRESSED_DXT1_RGB = 14,
COMPRESSED_DXT1_RGBA = 15,
COMPRESSED_DXT3_RGBA = 16,
COMPRESSED_DXT5_RGBA = 17,
COMPRESSED_ETC1_RGB = 18,
COMPRESSED_ETC2_RGB = 19,
COMPRESSED_ETC2_EAC_RGBA = 20,
COMPRESSED_PVRT_RGB = 21,
COMPRESSED_PVRT_RGBA = 22,
COMPRESSED_ASTC_4x4_RGBA = 23,
COMPRESSED_ASTC_8x8_RGBA = 24
}
--------------------------------------------------------------------------------------------------------------------------
global rlgl.shaderUniformDataType: type <cimport'rlTextureFilter', cinclude'<rlgl.h>',nodecl,using> = @enum(cint){
POINT = 0,
BILINEAR = 1,
TRILINEAR = 2,
ANISOTROPIC_4X = 3,
ANISOTROPIC_8X = 4,
ANISOTROPIC_16X = 5,
}
--------------------------------------------------------------------------------------------------------------------------
global rlgl.blendMode: type <cimport'rlBlendMode', cinclude'<rlgl.h>',nodecl,using> = @enum(cint){
ALPHA = 0,
ADDITIVE = 1,
MULTIPLIED = 2,
ADD_COLORS = 3,
SUBTRACT_COLORS = 4,
ALPHA_PREMULTIPLY = 5,
CUSTOM = 6,
CUSTOM_SEPARATE = 7
}
--------------------------------------------------------------------------------------------------------------------------
global rlgl.shaderLocationIndex: type <cimport'rlShaderLocationIndex', cinclude'<rlgl.h>',nodecl,using> = @enum(cint){
VERTEX_POSITION = 0,
VERTEX_TEXCOORD01 = 1,
VERTEX_TEXCOORD02 = 2,
VERTEX_NORMAL = 3,
VERTEX_TANGENT = 4,
VERTEX_COLOR = 5,
MATRIX_MVP = 6,
MATRIX_VIEW = 7,
MATRIX_PROJECTION = 8,
MATRIX_MODEL = 9,
MATRIX_NORMAL = 10,
VECTOR_VIEW = 11,
COLOR_DIFFUSE = 12,
COLOR_SPECULAR = 13,
COLOR_AMBIENT = 14,
MAP_ALBEDO = 15,
MAP_METALNESS = 16,
MAP_NORMAL = 17,
MAP_ROUGHNESS = 18,
MAP_OCCLUSION = 19,
MAP_EMISSION = 20,
MAP_HEIGHT = 21,
MAP_CUBEMAP = 22,
MAP_IRRADIANCE = 23,
MAP_PREFILTER = 24,
MAP_BRDF = 25
}
--------------------------------------------------------------------------------------------------------------------------
global rlgl.shaderUniformDataType: type <cimport'rlShaderUniformDataType', cinclude'<rlgl.h>',nodecl,using> = @enum(cint){
FLOAT = 0,
VEC2 = 1,
VEC3 = 2,
VEC4 = 3,
INT = 4,
IVEC2 = 5,
IVEC3 = 6,
IVEC4 = 7,
UINT = 8,
UIVEC2 = 9,
UIVEC3 = 10,
UIVEC4 = 11,
SAMPLER2D = 12
}
--------------------------------------------------------------------------------------------------------------------------
-- Matrix Operations
function rlgl.matrixMode(mode: cint): void <cimport'rlMatrixMode', cinclude'<rlgl.h>',nodecl> end
function rlgl.pushMatrix(): void <cimport'rlPushMatrix', cinclude'<rlgl.h>',nodecl> end
function rlgl.popMatrix(): void <cimport'rlPopMatrix', cinclude'<rlgl.h>',nodecl> end
function rlgl.loadIdentity(): void <cimport'rlLoadIdentity', cinclude'<rlgl.h>',nodecl> end
function rlgl.translatef(x: float32, y: float32, z: float32): void <cimport'rlTranslatef', cinclude'<rlgl.h>',nodecl> end
function rlgl.rotatef(angle: float32, x: float32, y: float32, z: float32): void <cimport'rlRotatef', cinclude'<rlgl.h>',nodecl> end
function rlgl.scalef(x: float32, y: float32, z: float32): void <cimport'rlScalef', cinclude'<rlgl.h>',nodecl> end
function rlgl.multMatrixf(matf: *float32): void <cimport'rlMultMatrixf', cinclude'<rlgl.h>',nodecl> end
function rlgl.frustum(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): void <cimport'rlFrustum', cinclude'<rlgl.h>',nodecl> end
function rlgl.ortho(left: number, right: number, bottom: number, top: number, znear: number, zfar: number): void <cimport'rlOrtho', cinclude'<rlgl.h>',nodecl> end
function rlgl.viewport(x: cint, y: cint, width: cint, height: cint): void <cimport'rlViewport', cinclude'<rlgl.h>',nodecl> end
function rlgl.setClipPlanes(nearPlane: float64, farPlane: float64): void <cimport'rlSetClipPlanes', cinclude'<rlgl.h>',nodecl> end
function rlgl.getCullDistanceNear(): float64 <cimport'rlGetCullDistanceNear', cinclude'<rlgl.h>',nodecl> end
function rlgl.getCullDistanceFar(): float64 <cimport'rlGetCullDistanceFar', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Vertex level operations
function rlgl.begin(mode: cint): void <cimport'rlBegin', cinclude'<rlgl.h>',nodecl> end
function rlgl.ending(): void <cimport'rlEnd', cinclude'<rlgl.h>',nodecl> end
function rlgl.vertex2i(x: cint, y: cint): void <cimport'rlVertex2i', cinclude'<rlgl.h>',nodecl> end
function rlgl.vertex2f(x: float32, y: float32): void <cimport'rlVertex2f', cinclude'<rlgl.h>',nodecl> end
function rlgl.vertex3f(x: float32, y: float32, z: float32): void <cimport'rlVertex3f', cinclude'<rlgl.h>',nodecl> end
function rlgl.texCoord2f(x: float32, y: float32): void <cimport'rlTexCoord2f', cinclude'<rlgl.h>',nodecl> end
function rlgl.normal3f(x: float32, y: float32, z: float32): void <cimport'rlNormal3f', cinclude'<rlgl.h>',nodecl> end
function rlgl.color4ub(r: cuchar, g: cuchar, b: cuchar, a: cuchar): void <cimport'rlColor4ub', cinclude'<rlgl.h>',nodecl> end
function rlgl.color3f(x: float32, y: float32, z: float32): void <cimport'rlColor3f', cinclude'<rlgl.h>',nodecl> end
function rlgl.color4f(x: float32, y: float32, z: float32, w: float32): void <cimport'rlColor4f', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Functions Declaration - OpenGL style functions (common to 1.1, 3.3+, ES2)
-- NOTE: This functions are used to completely abstract raylib code from OpenGL layer,
-- some of them are direct wrappers over OpenGL calls, some others are custom
-- Vertex buffers state
function rlgl.enableVertexArray(vaoId: cuint): void <cimport'rlEnableVertexArray', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableVertexArray(): void <cimport'rlDisableVertexArray', cinclude'<rlgl.h>',nodecl> end
function rlgl.enableVertexBuffer(id: cuint): void <cimport'rlEnableVertexBuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableVertexBuffer(): void <cimport'rlDisableVertexBuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.enableVertexBufferElement(id: cuint): void <cimport'rlEnableVertexBufferElement', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableVertexBufferElement(): void <cimport'rlDisableVertexBufferElement', cinclude'<rlgl.h>',nodecl> end
function rlgl.enableVertexAttribute(index: cuint): void <cimport'rlEnableVertexAttribute', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableVertexAttribute(index: cuint): void <cimport'rlDisableVertexAttribute', cinclude'<rlgl.h>',nodecl> end
function rlgl.enableStatePointer(vertexAttribType: cint, buffer: pointer): void <cimport'rlEnableStatePointer', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableStatePointer(vertexAttribType: cint): void <cimport'rlDisableStatePointer', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Textures state
function rlgl.activeTextureSlot(slot: cint): void <cimport'rlActiveTextureSlot', cinclude'<rlgl.h>',nodecl> end
function rlgl.enableTexture(id: cuint): void <cimport'rlEnableTexture', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableTexture(): void <cimport'rlDisableTexture', cinclude'<rlgl.h>',nodecl> end
function rlgl.enableTextureCubemap(id: cuint): void <cimport'rlEnableTextureCubemap', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableTextureCubemap(): void <cimport'rlDisableTextureCubemap', cinclude'<rlgl.h>',nodecl> end
function rlgl.textureParameters(id: cuint, param: cint, value: cint): void <cimport'rlTextureParameters', cinclude'<rlgl.h>',nodecl> end
function rlgl.cubemapParameters(id: cuint, param: cint, value: cint): void <cimport'rlCubemapParameters', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Shader state
function rlgl.enableShader(id: cuint): void <cimport'rlEnableShader', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableShader(): void <cimport'rlDisableShader', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Framebuffer state
function rlgl.enableFramebuffer(id: cuint): void <cimport'rlEnableFramebuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableFramebuffer(): void <cimport'rlDisableFramebuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.getActiveFramebuffer(): cuint <cimport'rlGetActiveFramebuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.activeDrawBuffers(count: cint): void <cimport'rlActiveDrawBuffers', cinclude'<rlgl.h>',nodecl> end
function rlgl.blitFramebuffer(srcX: cint, srcY: cint, srcWidth: cint, srcHeight: cint, dstX: cint, dstY: cint, dstWidth: cint, dstHeight: cint, bufferMask: cint): void <cimport'rlBlitFramebuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.bindFramebuffer(target: uint, framebuffer: uint): void <cimport'rlBindFramebuffer', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- General render state
function rlgl.enableColorBlend(): void <cimport'rlEnableColorBlend', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableColorBlend(): void <cimport'rlDisableColorBlend', cinclude'<rlgl.h>',nodecl> end
function rlgl.enableDepthTest(): void <cimport'rlEnableDepthTest', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableDepthTest(): void <cimport'rlDisableDepthTest', cinclude'<rlgl.h>',nodecl> end
function rlgl.enableDepthMask(): void <cimport'rlEnableDepthMask', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableDepthMask(): void <cimport'rlDisableDepthMask', cinclude'<rlgl.h>',nodecl> end
function rlgl.enableBackfaceCulling(): void <cimport'rlEnableBackfaceCulling', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableBackfaceCulling(): void <cimport'rlDisableBackfaceCulling', cinclude'<rlgl.h>',nodecl> end
function rlgl.colorMask(r: boolean, g: boolean, b: boolean, a: boolean): void <cimport'rlColorMask', cinclude'<rlgl.h>',nodecl> end
function rlgl.setCullFace(mode: cint): void <cimport'rlSetCullFace', cinclude'<rlgl.h>',nodecl> end
function rlgl.enableScissorTest(): void <cimport'rlEnableScissorTest', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableScissorTest(): void <cimport'rlDisableScissorTest', cinclude'<rlgl.h>',nodecl> end
function rlgl.scissor(x: cint, y: cint, width: cint, height: cint): void <cimport'rlScissor', cinclude'<rlgl.h>',nodecl> end
function rlgl.enableWireMode(): void <cimport'rlEnableWireMode', cinclude'<rlgl.h>',nodecl> end
function rlgl.enablePointMode(): void <cimport'rlEnablePointMode', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableWireMode(): void <cimport'rlDisableWireMode', cinclude'<rlgl.h>',nodecl> end
function rlgl.setLineWidth(width: float32): void <cimport'rlSetLineWidth', cinclude'<rlgl.h>',nodecl> end
function rlgl.getLineWidth(): float32 <cimport'rlGetLineWidth', cinclude'<rlgl.h>',nodecl> end
function rlgl.enableSmoothLines(): void <cimport'rlEnableSmoothLines', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableSmoothLines(): void <cimport'rlDisableSmoothLines', cinclude'<rlgl.h>',nodecl> end
function rlgl.enableStereoRender(): void <cimport'rlEnableStereoRender', cinclude'<rlgl.h>',nodecl> end
function rlgl.disableStereoRender(): void <cimport'rlDisableStereoRender', cinclude'<rlgl.h>',nodecl> end
function rlgl.isStereoRenderEnabled(): boolean <cimport'rlIsStereoRenderEnabled', cinclude'<rlgl.h>',nodecl> end
function rlgl.clearColor(r: cuchar, g: cuchar, b: cuchar, a: cuchar): void <cimport'rlClearColor', cinclude'<rlgl.h>',nodecl> end
function rlgl.clearScreenBuffers(): void <cimport'rlClearScreenBuffers', cinclude'<rlgl.h>',nodecl> end
function rlgl.checkErrors(): void <cimport'rlCheckErrors', cinclude'<rlgl.h>',nodecl> end
function rlgl.setBlendMode(mode: cint): void <cimport'rlSetBlendMode', cinclude'<rlgl.h>',nodecl> end
function rlgl.setBlendFactors(glSrcFactor: cint, glDstFactor: cint, glEquation: cint): void <cimport'rlSetBlendFactors', cinclude'<rlgl.h>',nodecl> end
function rlgl.setBlendFactorsSeparate(glSrcRGB: cint, glDstRGB: cint, glSrcAlpha: cint, glDstAlpha: cint, glEqRGB: cint, glEqAlpha: cint): void <cimport'rlSetBlendFactorsSeparate', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Functions Declaration - rlgl functionality
-- rlgl initialization functions
function rlgl.init(width: cint, height: cint): void <cimport'rlglInit', cinclude'<rlgl.h>',nodecl> end
function rlgl.close(): void <cimport'rlglClose', cinclude'<rlgl.h>',nodecl> end
function rlgl.loadExtensions(loader: pointer): void <cimport'rlLoadExtensions', cinclude'<rlgl.h>',nodecl> end
function rlgl.getVersion(): cint <cimport'rlGetVersion', cinclude'<rlgl.h>',nodecl> end
function rlgl.setFramebufferWidth(width: cint): void <cimport'rlSetFramebufferWidth', cinclude'<rlgl.h>',nodecl> end
function rlgl.getFramebufferWidth(): cint <cimport'rlGetFramebufferWidth', cinclude'<rlgl.h>',nodecl> end
function rlgl.setFramebufferHeight(height: cint): void <cimport'rlSetFramebufferHeight', cinclude'<rlgl.h>',nodecl> end
function rlgl.getFramebufferHeight(): cint <cimport'rlGetFramebufferHeight', cinclude'<rlgl.h>',nodecl> end
function rlgl.getTextureIdDefault(): cuint <cimport'rlGetTextureIdDefault', cinclude'<rlgl.h>',nodecl> end
function rlgl.getShaderIdDefault(): cuint <cimport'rlGetShaderIdDefault', cinclude'<rlgl.h>',nodecl> end
function rlgl.getShaderLocsDefault(): cint <cimport'rlGetShaderLocsDefault', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Render batch management
-- NOTE: rlgl provides a default render batch to behave like OpenGL 1.1 immediate mode
-- but this render batch API is exposed in case of custom batches are required
--function rlgl.LoadRenderBatch(numBuffers: cint, bufferElements: cint): rlgl.renderBatch <cimport'rlLoadRenderBatch', cinclude'<rlgl.h>',nodecl> end
--function rlgl.unloadRenderBatch(batch: rlgl.renderBatch): void <cimport'rlUnloadRenderBatch', cinclude'<rlgl.h>',nodecl> end
--function rlgl.drawRenderBatch(batch: *rlgl.renderBatch): void <cimport'rlDrawRenderBatch', cinclude'<rlgl.h>',nodecl> end
--function rlgl.setRenderBatchActive(batch: *rlgl.renderBatch): void <cimport'rlSetRenderBatchActive', cinclude'<rlgl.h>',nodecl> end
function rlgl.drawRenderBatchActive(): void <cimport'rlDrawRenderBatchActive', cinclude'<rlgl.h>',nodecl> end
function rlgl.checkRenderBatchLimit(vCount: cint): boolean <cimport'rlCheckRenderBatchLimit', cinclude'<rlgl.h>',nodecl> end
function rlgl.setTexture(id: cuint): void <cimport'rlSetTexture', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Vertex buffers management
function rlgl.loadVertexArray(): cuint <cimport'rlLoadVertexArray', cinclude'<rlgl.h>',nodecl> end
function rlgl.loadVertexBuffer(buffer: pointer, size: cint, dynamic: boolean): cuint <cimport'rlLoadVertexBuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.loadVertexBufferElement(buffer: pointer, size: cint, dynamic: boolean): cuint <cimport'rlLoadVertexBufferElement', cinclude'<rlgl.h>',nodecl> end
function rlgl.updateVertexBuffer(bufferId: cuint, data: pointer, dataSize: cint, offset: cint): void <cimport'rlUpdateVertexBuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.updateVertexBufferElements(id: cuint, data: pointer, dataSize: cint, offset: cint): void <cimport'rlUpdateVertexBufferElements', cinclude'<rlgl.h>',nodecl> end
function rlgl.unloadVertexArray(vaoId: cuint): void <cimport'rlUnloadVertexArray', cinclude'<rlgl.h>',nodecl> end
function rlgl.unloadVertexBuffer(vboId: cuint): void <cimport'rlUnloadVertexBuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.setVertexAttribute(index: cuint, compSize: cint, type: cint, normalized: boolean, stride: cint, pointer: pointer): void <cimport'rlSetVertexAttribute', cinclude'<rlgl.h>',nodecl> end
function rlgl.setVertexAttributeDivisor(index: cuint, divisor: cint): void <cimport'rlSetVertexAttributeDivisor', cinclude'<rlgl.h>',nodecl> end
function rlgl.setVertexAttributeDefault(locIndex: cint, value: pointer, attribType: cint, count: cint): void <cimport'rlSetVertexAttributeDefault', cinclude'<rlgl.h>',nodecl> end
function rlgl.drawVertexArray(offset: cint, count: cint): void <cimport'rlDrawVertexArray', cinclude'<rlgl.h>',nodecl> end
function rlgl.drawVertexArrayElements(offset: cint, count: cint, buffer: pointer): void <cimport'rlDrawVertexArrayElements', cinclude'<rlgl.h>',nodecl> end
function rlgl.drawVertexArrayInstanced(offset: cint, count: cint, instances: cint): void <cimport'rlDrawVertexArrayInstanced', cinclude'<rlgl.h>',nodecl> end
function rlgl.drawVertexArrayElementsInstanced(offset: cint, count: cint, buffer: pointer, instances: cint): void <cimport'rlDrawVertexArrayElementsInstanced', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Textures management
function rlgl.loadTexture(data: pointer, width: cint, height: cint, format: cint, mipmapCount: cint): cuint <cimport'rlLoadTexture', cinclude'<rlgl.h>',nodecl> end
function rlgl.loadTextureDepth(width: cint, height: cint, useRenderBuffer: boolean): cuint <cimport'rlLoadTextureDepth', cinclude'<rlgl.h>',nodecl> end
function rlgl.loadTextureCubemap(data: pointer, size: cint, format: cint): cuint <cimport'rlLoadTextureCubemap', cinclude'<rlgl.h>',nodecl> end
function rlgl.updateTexture(id: cuint, offsetX: cint, offsetY: cint, width: cint, height: cint, format: cint, data: pointer): void <cimport'rlUpdateTexture', cinclude'<rlgl.h>',nodecl> end
function rlgl.getGlTextureFormats(format: cint, glInternalFormat: *cuint, glFormat: *cuint, glType: *cuint): void <cimport'rlGetGlTextureFormats', cinclude'<rlgl.h>',nodecl> end
function rlgl.getPixelFormatName(format: cuint): cstring <cimport'rlGetPixelFormatName', cinclude'<rlgl.h>',nodecl> end
function rlgl.unloadTexture(id: cuint): void <cimport'rlUnloadTexture', cinclude'<rlgl.h>',nodecl> end
function rlgl.genTextureMipmaps(id: cuint, width: cint, height: cint, format: cint, mipmaps: *cint): void <cimport'rlGenTextureMipmaps', cinclude'<rlgl.h>',nodecl> end
function rlgl.readTexturePixels(id: cuint, width: cint, height: cint, format: cint): void <cimport'rlReadTexturePixels', cinclude'<rlgl.h>',nodecl> end
function rlgl.readScreenPixels(width: cint, height: cint): cstring <cimport'rlReadScreenPixels', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Framebuffer management (fbo)
function rlgl.loadFramebuffer(): cuint <cimport'rlLoadFramebuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.framebufferAttach(fboId: cuint, texId: cuint, attachType: cint, texType: cint, mipLevel: cint): void <cimport'rlFramebufferAttach', cinclude'<rlgl.h>',nodecl> end
function rlgl.framebufferComplete(id: cuint): boolean <cimport'rlFramebufferComplete', cinclude'<rlgl.h>',nodecl> end
function rlgl.unloadFramebuffer(id: cuint): void <cimport'rlUnloadFramebuffer', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Shaders management
function rlgl.loadShaderCode(vsCode: cstring, fsCode: cstring): cuint <cimport'rlLoadShaderCode', cinclude'<rlgl.h>',nodecl> end
function rlgl.compileShader(shaderCode: cstring, type: cint): cuint <cimport'rlCompileShader', cinclude'<rlgl.h>',nodecl> end
function rlgl.loadShaderProgram(vShaderId: cuint, fShaderId: cuint): cuint <cimport'rlLoadShaderProgram', cinclude'<rlgl.h>',nodecl> end
function rlgl.unloadShaderProgram(id: cuint): void <cimport'rlUnloadShaderProgram', cinclude'<rlgl.h>',nodecl> end
function rlgl.getLocationUniform(shaderId: cuint, uniformName: cstring): cint <cimport'rlGetLocationUniform', cinclude'<rlgl.h>',nodecl> end
function rlgl.getLocationAttrib(shaderId: cuint, attribName: cstring): cint <cimport'rlGetLocationAttrib', cinclude'<rlgl.h>',nodecl> end
function rlgl.setUniform(locIndex: cint, value: pointer, uniformType: cint, count: cint): void <cimport'rlSetUniform', cinclude'<rlgl.h>',nodecl> end
function rlgl.setUniformMatrix(locIndex: cint, mat: rl.matrix): void <cimport'rlSetUniformMatrix', cinclude'<rlgl.h>',nodecl> end
function rlgl.setUniformSampler(locIndex: cint, textureId: cuint): void <cimport'rlSetUniformSampler', cinclude'<rlgl.h>',nodecl> end
function rlgl.setShader(id: cuint, locs: *cint): void <cimport'rlSetShader', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Compute shader management
function rlgl.loadComputeShaderProgram(shaderId: cuint): cuint <cimport'rlLoadComputeShaderProgram', cinclude'<rlgl.h>',nodecl> end
function rlgl.computeShaderDispatch(groupX: cuint, groupY: cuint, groupZ: cuint): void <cimport'rlComputeShaderDispatch', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Shader buffer storage object management (ssbo)
function rlgl.loadShaderBuffer(size: cuint, data: pointer, usageHint: cint): cuint <cimport'rlLoadShaderBuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.unloadShaderBuffer(ssboId: cuint): void <cimport'rlUnloadShaderBuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.updateShaderBuffer(id: cuint, data: pointer, dataSize: cuint, offset: cuint): void <cimport'rlUpdateShaderBuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.bindShaderBuffer(id: cuint, index: cuint): void <cimport'rlBindShaderBuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.readShaderBuffer(id: cuint, dest: pointer, count: cuint, offset: cuint): void <cimport'rlReadShaderBuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.copyShaderBuffer(destId: cuint, srcId: cuint, destOffset: cuint, srcOffset: cuint, count: cuint): void <cimport'rlCopyShaderBuffer', cinclude'<rlgl.h>',nodecl> end
function rlgl.getShaderBufferSize(id: cuint): cuint <cimport'rlGetShaderBufferSize', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Buffer management
function rlgl.bindImageTexture(id: cuint, index: cuint, format: cint, readonly: boolean): void <cimport'rlBindImageTexture', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------
-- Matrix state management
function rlgl.getMatrixModelview(): rl.matrix <cimport'rlGetMatrixModelview', cinclude'<rlgl.h>',nodecl> end
function rlgl.getMatrixProjection(): rl.matrix <cimport'rlGetMatrixProjection', cinclude'<rlgl.h>',nodecl> end
function rlgl.getMatrixTransform(): rl.matrix <cimport'rlGetMatrixTransform', cinclude'<rlgl.h>',nodecl> end
function rlgl.getMatrixProjectionStereo(eye: cint): rl.matrix <cimport'rlGetMatrixProjectionStereo', cinclude'<rlgl.h>',nodecl> end
function rlgl.getMatrixViewOffsetStereo(eye: cint): rl.matrix <cimport'rlGetMatrixViewOffsetStereo', cinclude'<rlgl.h>',nodecl> end
function rlgl.setMatrixProjection(proj: rl.matrix): void <cimport'rlSetMatrixProjection', cinclude'<rlgl.h>',nodecl> end
function rlgl.setMatrixModelview(view: rl.matrix): void <cimport'rlSetMatrixModelview', cinclude'<rlgl.h>',nodecl> end
function rlgl.setMatrixProjectionStereo(right: rl.matrix, left: rl.matrix): void <cimport'rlSetMatrixProjectionStereo', cinclude'<rlgl.h>',nodecl> end
function rlgl.setMatrixViewOffsetStereo(right: rl.matrix, left: rl.matrix): void <cimport'rlSetMatrixViewOffsetStereo', cinclude'<rlgl.h>',nodecl> end
-- Quick and dirty cube/quad buffers load->draw->unload
function rlgl.loadDrawCube(): void <cimport'rlLoadDrawCube', cinclude'<rlgl.h>',nodecl> end
function rlgl.loadDrawQuad(): void <cimport'rlLoadDrawQuad', cinclude'<rlgl.h>',nodecl> end
--------------------------------------------------------------------------------------------------------------------------