1 ! Copyright (C) 2023 CapitalEx.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: accessors alien alien.c-types alien.libraries
4 alien.syntax classes.struct combinators kernel math multiline
5 raylib raylib.util system ;
6 FROM: alien.c-types => float ;
11 { [ os windows? ] [ "raylib.dll" ] }
12 { [ os macosx? ] [ "libraylib.dylib" ] }
13 { [ os unix? ] [ "libraylib.so" ] }
14 } cond cdecl add-library
16 "raylib" deploy-library
19 CONSTANT: RLGL_VERSION "4.5"
21 CONSTANT: RL_TEXTURE_WRAP_S 0x2802 ! GL_TEXTURE_WRAP_S
22 CONSTANT: RL_TEXTURE_WRAP_T 0x2803 ! GL_TEXTURE_WRAP_T
23 CONSTANT: RL_TEXTURE_MAG_FILTER 0x2800 ! GL_TEXTURE_MAG_FILTER
24 CONSTANT: RL_TEXTURE_MIN_FILTER 0x2801 ! GL_TEXTURE_MIN_FILTER
26 CONSTANT: RL_TEXTURE_FILTER_NEAREST 0x2600 ! GL_NEAREST
27 CONSTANT: RL_TEXTURE_FILTER_LINEAR 0x2601 ! GL_LINEAR
28 CONSTANT: RL_TEXTURE_FILTER_MIP_NEAREST 0x2700 ! GL_NEAREST_MIPMAP_NEAREST
29 CONSTANT: RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR 0x2702 ! GL_NEAREST_MIPMAP_LINEAR
30 CONSTANT: RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST 0x2701 ! GL_LINEAR_MIPMAP_NEAREST
31 CONSTANT: RL_TEXTURE_FILTER_MIP_LINEAR 0x2703 ! GL_LINEAR_MIPMAP_LINEAR
32 CONSTANT: RL_TEXTURE_FILTER_ANISOTROPIC 0x3000 ! Anisotropic filter (custom identifier)
33 CONSTANT: RL_TEXTURE_MIPMAP_BIAS_RATIO 0x4000 ! Texture mipmap bias, percentage ratio (custom identifier)
35 CONSTANT: RL_TEXTURE_WRAP_REPEAT 0x2901 ! GL_REPEAT
36 CONSTANT: RL_TEXTURE_WRAP_CLAMP 0x812F ! GL_CLAMP_TO_EDGE
37 CONSTANT: RL_TEXTURE_WRAP_MIRROR_REPEAT 0x8370 ! GL_MIRRORED_REPEAT
38 CONSTANT: RL_TEXTURE_WRAP_MIRROR_CLAMP 0x8742 ! GL_MIRROR_CLAMP_EXT
40 ! Matrix modes (equivalent to OpenGL)
41 CONSTANT: RL_MODELVIEW 0x1700 ! GL_MODELVIEW
42 CONSTANT: RL_PROJECTION 0x1701 ! GL_PROJECTION
43 CONSTANT: RL_TEXTURE 0x1702 ! GL_TEXTURE
45 ! Primitive assembly draw modes
46 CONSTANT: RL_LINES 0x0001 ! GL_LINES
47 CONSTANT: RL_TRIANGLES 0x0004 ! GL_TRIANGLES
48 CONSTANT: RL_QUADS 0x0007 ! GL_QUADS
50 ! GL equivalent data types
51 CONSTANT: RL_UNSIGNED_BYTE 0x1401 ! GL_UNSIGNED_BYTE
52 CONSTANT: RL_FLOAT 0x1406 ! GL_FLOAT
54 ! GL buffer usage hint
55 CONSTANT: RL_STREAM_DRAW 0x88E0 ! GL_STREAM_DRAW
56 CONSTANT: RL_STREAM_READ 0x88E1 ! GL_STREAM_READ
57 CONSTANT: RL_STREAM_COPY 0x88E2 ! GL_STREAM_COPY
58 CONSTANT: RL_STATIC_DRAW 0x88E4 ! GL_STATIC_DRAW
59 CONSTANT: RL_STATIC_READ 0x88E5 ! GL_STATIC_READ
60 CONSTANT: RL_STATIC_COPY 0x88E6 ! GL_STATIC_COPY
61 CONSTANT: RL_DYNAMIC_DRAW 0x88E8 ! GL_DYNAMIC_DRAW
62 CONSTANT: RL_DYNAMIC_READ 0x88E9 ! GL_DYNAMIC_READ
63 CONSTANT: RL_DYNAMIC_COPY 0x88EA ! GL_DYNAMIC_COPY
66 CONSTANT: RL_FRAGMENT_SHADER 0x8B30 ! GL_FRAGMENT_SHADER
67 CONSTANT: RL_VERTEX_SHADER 0x8B31 ! GL_VERTEX_SHADER
68 CONSTANT: RL_COMPUTE_SHADER 0x91B9 ! GL_COMPUTE_SHADER
71 CONSTANT: RL_ZERO 0 ! GL_ZERO
72 CONSTANT: RL_ONE 1 ! GL_ONE
73 CONSTANT: RL_SRC_COLOR 0x0300 ! GL_SRC_COLOR
74 CONSTANT: RL_ONE_MINUS_SRC_COLOR 0x0301 ! GL_ONE_MINUS_SRC_COLOR
75 CONSTANT: RL_SRC_ALPHA 0x0302 ! GL_SRC_ALPHA
76 CONSTANT: RL_ONE_MINUS_SRC_ALPHA 0x0303 ! GL_ONE_MINUS_SRC_ALPHA
77 CONSTANT: RL_DST_ALPHA 0x0304 ! GL_DST_ALPHA
78 CONSTANT: RL_ONE_MINUS_DST_ALPHA 0x0305 ! GL_ONE_MINUS_DST_ALPHA
79 CONSTANT: RL_DST_COLOR 0x0306 ! GL_DST_COLOR
80 CONSTANT: RL_ONE_MINUS_DST_COLOR 0x0307 ! GL_ONE_MINUS_DST_COLOR
81 CONSTANT: RL_SRC_ALPHA_SATURATE 0x0308 ! GL_SRC_ALPHA_SATURATE
82 CONSTANT: RL_CONSTANT_COLOR 0x8001 ! GL_CONSTANT_COLOR
83 CONSTANT: RL_ONE_MINUS_CONSTANT_COLOR 0x8002 ! GL_ONE_MINUS_CONSTANT_COLOR
84 CONSTANT: RL_CONSTANT_ALPHA 0x8003 ! GL_CONSTANT_ALPHA
85 CONSTANT: RL_ONE_MINUS_CONSTANT_ALPHA 0x8004 ! GL_ONE_MINUS_CONSTANT_ALPHA
87 ! GL blending functions/equations
88 CONSTANT: RL_FUNC_ADD 0x8006 ! GL_FUNC_ADD
89 CONSTANT: RL_MIN 0x8007 ! GL_MIN
90 CONSTANT: RL_MAX 0x8008 ! GL_MAX
91 CONSTANT: RL_FUNC_SUBTRACT 0x800A ! GL_FUNC_SUBTRACT
92 CONSTANT: RL_FUNC_REVERSE_SUBTRACT 0x800B ! GL_FUNC_REVERSE_SUBTRACT
93 CONSTANT: RL_BLEND_EQUATION 0x8009 ! GL_BLEND_EQUATION
94 CONSTANT: RL_BLEND_EQUATION_RGB 0x8009 ! GL_BLEND_EQUATION_RGB ! (Same as BLEND_EQUATION)
95 CONSTANT: RL_BLEND_EQUATION_ALPHA 0x883D ! GL_BLEND_EQUATION_ALPHA
96 CONSTANT: RL_BLEND_DST_RGB 0x80C8 ! GL_BLEND_DST_RGB
97 CONSTANT: RL_BLEND_SRC_RGB 0x80C9 ! GL_BLEND_SRC_RGB
98 CONSTANT: RL_BLEND_DST_ALPHA 0x80CA ! GL_BLEND_DST_ALPHA
99 CONSTANT: RL_BLEND_SRC_ALPHA 0x80CB ! GL_BLEND_SRC_ALPHA
100 CONSTANT: RL_BLEND_COLOR 0x8005 ! GL_BLEND_COLOR
103 STRUCT: rlVertexBuffer
104 { elementCount int } ! Number of elements in the buffer ( QUADS )
105 { _vertices float* } ! Vertex position ( XYZ - 3 components per vertex ) ( shader-location = 0 )
106 { _texcoords float* } ! Vertex texture coordinates ( UV - 2 components per vertex ) ( shader-location = 1 )
107 { _colors uchar* } ! Vertex colors ( RGBA - 4 components per vertex ) ( shader-location = 3 )
108 { _indices uint* } ! Vertex indices ( in case vertex data comes indexed ) ( 6 indices per quad )
109 { vaoId uint } ! OpenGL Vertex Array Object id
110 { vboId uint[4] } ! OpenGL Vertex Buffer Objects id ( 4 types of vertex data )
113 ARRAY-SLOT: rlVertexBuffer float _vertices [ elementCount>> 3 * ] vertices
114 ARRAY-SLOT: rlVertexBuffer float _texcoords [ elementCount>> 2 * ] texcoords
115 ARRAY-SLOT: rlVertexBuffer uchar _colors [ elementCount>> 4 * ] colors
116 ARRAY-SLOT: rlVertexBuffer uint _indices [ elementCount>> 6 * ] indices
119 ! NOTE: Only texture changes register a new draw, other state-change-related elements are not
120 ! used at this moment ( vaoId, shaderId, matrices ), raylib just forces a batch draw call if any
121 ! of those state-change happens ( this is done in core module )
123 { mode int } ! Drawing mode: LINES, TRIANGLES, QUADS
124 { vertexCount int } ! Number of vertex of the draw
125 { vertexAlignment int } ! Number of vertex required for index alignment ( LINES, TRIANGLES )
126 { textureId uint } ! Texture id to be used on the draw -> Use to create new draw call if changes
130 STRUCT: rlRenderBatch
131 { bufferCount int } ! Number of vertex buffers ( multi-buffering support )
132 { currentBuffer int } ! Current buffer tracking in case of multi-buffering
133 { _vertexBuffer rlVertexBuffer* } ! Dynamic buffer ( s ) for vertex data
134 { _draws rlDrawCall* } ! Draw calls array, depends on textureId
135 { drawCounter int } ! Draw calls counter
136 { currentDepth float } ! Current depth value for next draw
139 ARRAY-SLOT: rlRenderBatch rlVertexBuffer _vertexBuffer [ bufferCount>> ] vertexBuffer
140 ARRAY-SLOT: rlRenderBatch rlDrawCall _draws [ drawCounter>> ] draws
144 RL_OPENGL_11 ! OpenGL 1.1
145 RL_OPENGL_21 ! OpenGL 2.1 ( GLSL 120 )
146 RL_OPENGL_33 ! OpenGL 3.3 ( GLSL 330 )
147 RL_OPENGL_43 ! OpenGL 4.3 ( using GLSL 330 )
148 RL_OPENGL_ES_20 ! OpenGL ES 2.0 ( GLSL 100 )
152 ! NOTE: Organized by priority level
153 ENUM: rlTraceLogLevel
154 RL_LOG_ALL ! Display all logs
155 RL_LOG_TRACE ! Trace logging, intended for internal use only
156 RL_LOG_DEBUG ! Debug logging, used for internal debugging, it should be disabled on release builds
157 RL_LOG_INFO ! Info logging, used for program execution info
158 RL_LOG_WARNING ! Warning logging, used on recoverable failures
159 RL_LOG_ERROR ! Error logging, used on unrecoverable failures
160 RL_LOG_FATAL ! Fatal logging, used to abort program: exit ( EXIT_FAILURE )
161 RL_LOG_NONE ! Disable logging
164 ! Texture pixel formats
165 ! NOTE: Support depends on OpenGL version
167 RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE ! 8 bit per pixel ( no alpha )
168 RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA ! 8*2 bpp ( 2 channels )
169 RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5 ! 16 bpp
170 RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8 ! 24 bpp
171 RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 ! 16 bpp ( 1 bit alpha )
172 RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 ! 16 bpp ( 4 bit alpha )
173 RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 ! 32 bpp
174 RL_PIXELFORMAT_UNCOMPRESSED_R32 ! 32 bpp ( 1 channel - float )
175 RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32 ! 32*3 bpp ( 3 channels - float )
176 RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 ! 32*4 bpp ( 4 channels - float )
177 RL_PIXELFORMAT_COMPRESSED_DXT1_RGB ! 4 bpp ( no alpha )
178 RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA ! 4 bpp ( 1 bit alpha )
179 RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA ! 8 bpp
180 RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA ! 8 bpp
181 RL_PIXELFORMAT_COMPRESSED_ETC1_RGB ! 4 bpp
182 RL_PIXELFORMAT_COMPRESSED_ETC2_RGB ! 4 bpp
183 RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA ! 8 bpp
184 RL_PIXELFORMAT_COMPRESSED_PVRT_RGB ! 4 bpp
185 RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA ! 4 bpp
186 RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA ! 8 bpp
187 RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA ! 2 bpp
190 ! Texture parameters: filter mode
191 ! NOTE 1: Filtering considers mipmaps if available in the texture
192 ! NOTE 2: Filter is accordingly set for minification and magnification
193 ENUM: rlTextureFilter
194 RL_TEXTURE_FILTER_POINT ! No filter, just pixel approximation
195 RL_TEXTURE_FILTER_BILINEAR ! Linear filtering
196 RL_TEXTURE_FILTER_TRILINEAR ! Trilinear filtering ( linear with mipmaps )
197 RL_TEXTURE_FILTER_ANISOTROPIC_4X ! Anisotropic filtering 4x
198 RL_TEXTURE_FILTER_ANISOTROPIC_8X ! Anisotropic filtering 8x
199 RL_TEXTURE_FILTER_ANISOTROPIC_16X ! Anisotropic filtering 16x
202 ! Color blending modes ( pre-defined )
204 RL_BLEND_ALPHA ! Blend textures considering alpha ( default )
205 RL_BLEND_ADDITIVE ! Blend textures adding colors
206 RL_BLEND_MULTIPLIED ! Blend textures multiplying colors
207 RL_BLEND_ADD_COLORS ! Blend textures adding colors ( alternative )
208 RL_BLEND_SUBTRACT_COLORS ! Blend textures subtracting colors ( alternative )
209 RL_BLEND_ALPHA_PREMULTIPLY ! Blend premultiplied textures considering alpha
210 RL_BLEND_CUSTOM ! Blend textures using custom src/dst factors ( use rlSetBlendFactors ( ) )
211 RL_BLEND_CUSTOM_SEPARATE ! Blend textures using custom src/dst factors ( use rlSetBlendFactorsSeparate ( ) )
214 ! Shader location point type
215 ENUM: rlShaderLocationIndex
216 RL_SHADER_LOC_VERTEX_POSITION ! Shader location: vertex attribute: position
217 RL_SHADER_LOC_VERTEX_TEXCOORD01 ! Shader location: vertex attribute: texcoord01
218 RL_SHADER_LOC_VERTEX_TEXCOORD02 ! Shader location: vertex attribute: texcoord02
219 RL_SHADER_LOC_VERTEX_NORMAL ! Shader location: vertex attribute: normal
220 RL_SHADER_LOC_VERTEX_TANGENT ! Shader location: vertex attribute: tangent
221 RL_SHADER_LOC_VERTEX_COLOR ! Shader location: vertex attribute: color
222 RL_SHADER_LOC_MATRIX_MVP ! Shader location: matrix uniform: model-view-projection
223 RL_SHADER_LOC_MATRIX_VIEW ! Shader location: matrix uniform: view ( camera transform )
224 RL_SHADER_LOC_MATRIX_PROJECTION ! Shader location: matrix uniform: projection
225 RL_SHADER_LOC_MATRIX_MODEL ! Shader location: matrix uniform: model ( transform )
226 RL_SHADER_LOC_MATRIX_NORMAL ! Shader location: matrix uniform: normal
227 RL_SHADER_LOC_VECTOR_VIEW ! Shader location: vector uniform: view
228 RL_SHADER_LOC_COLOR_DIFFUSE ! Shader location: vector uniform: diffuse color
229 RL_SHADER_LOC_COLOR_SPECULAR ! Shader location: vector uniform: specular color
230 RL_SHADER_LOC_COLOR_AMBIENT ! Shader location: vector uniform: ambient color
231 RL_SHADER_LOC_MAP_ALBEDO ! Shader location: sampler2d texture: albedo ( same as: RL_SHADER_LOC_MAP_DIFFUSE )
232 RL_SHADER_LOC_MAP_METALNESS ! Shader location: sampler2d texture: metalness ( same as: RL_SHADER_LOC_MAP_SPECULAR )
233 RL_SHADER_LOC_MAP_NORMAL ! Shader location: sampler2d texture: normal
234 RL_SHADER_LOC_MAP_ROUGHNESS ! Shader location: sampler2d texture: roughness
235 RL_SHADER_LOC_MAP_OCCLUSION ! Shader location: sampler2d texture: occlusion
236 RL_SHADER_LOC_MAP_EMISSION ! Shader location: sampler2d texture: emission
237 RL_SHADER_LOC_MAP_HEIGHT ! Shader location: sampler2d texture: height
238 RL_SHADER_LOC_MAP_CUBEMAP ! Shader location: samplerCube texture: cubemap
239 RL_SHADER_LOC_MAP_IRRADIANCE ! Shader location: samplerCube texture: irradiance
240 RL_SHADER_LOC_MAP_PREFILTER ! Shader location: samplerCube texture: prefilter
241 RL_SHADER_LOC_MAP_BRDF ! Shader location: sampler2d texture: brdf
244 CONSTANT: RL_SHADER_LOC_MAP_DIFFUSE RL_SHADER_LOC_MAP_ALBEDO
245 CONSTANT: RL_SHADER_LOC_MAP_SPECULAR RL_SHADER_LOC_MAP_METALNESS
247 ! Shader uniform data type
248 ENUM: rlShaderUniformDataType
249 RL_SHADER_UNIFORM_FLOAT ! Shader uniform type: float
250 RL_SHADER_UNIFORM_VEC2 ! Shader uniform type: vec2 ( 2 float )
251 RL_SHADER_UNIFORM_VEC3 ! Shader uniform type: vec3 ( 3 float )
252 RL_SHADER_UNIFORM_VEC4 ! Shader uniform type: vec4 ( 4 float )
253 RL_SHADER_UNIFORM_INT ! Shader uniform type: int
254 RL_SHADER_UNIFORM_IVEC2 ! Shader uniform type: ivec2 ( 2 int )
255 RL_SHADER_UNIFORM_IVEC3 ! Shader uniform type: ivec3 ( 3 int )
256 RL_SHADER_UNIFORM_IVEC4 ! Shader uniform type: ivec4 ( 4 int )
257 RL_SHADER_UNIFORM_SAMPLER2D ! Shader uniform type: sampler2d
260 ! Shader attribute data types
261 ENUM: rlShaderAttributeDataType
262 RL_SHADER_ATTRIB_FLOAT ! Shader attribute type: float
263 RL_SHADER_ATTRIB_VEC2 ! Shader attribute type: vec2 ( 2 float )
264 RL_SHADER_ATTRIB_VEC3 ! Shader attribute type: vec3 ( 3 float )
265 RL_SHADER_ATTRIB_VEC4 ! Shader attribute type: vec4 ( 4 float )
268 ! Framebuffer attachment type
269 ! NOTE: By default up to 8 color channels defined, but it can be more
270 ENUM: rlFramebufferAttachType
271 RL_ATTACHMENT_COLOR_CHANNEL0 ! Framebuffer attachment type: color 0
272 RL_ATTACHMENT_COLOR_CHANNEL1 ! Framebuffer attachment type: color 1
273 RL_ATTACHMENT_COLOR_CHANNEL2 ! Framebuffer attachment type: color 2
274 RL_ATTACHMENT_COLOR_CHANNEL3 ! Framebuffer attachment type: color 3
275 RL_ATTACHMENT_COLOR_CHANNEL4 ! Framebuffer attachment type: color 4
276 RL_ATTACHMENT_COLOR_CHANNEL5 ! Framebuffer attachment type: color 5
277 RL_ATTACHMENT_COLOR_CHANNEL6 ! Framebuffer attachment type: color 6
278 RL_ATTACHMENT_COLOR_CHANNEL7 ! Framebuffer attachment type: color 7
279 { RL_ATTACHMENT_DEPTH 100 } ! Framebuffer attachment type: depth
280 { RL_ATTACHMENT_STENCIL 200 } ! Framebuffer attachment type: stencil
283 ! Framebuffer texture attachment type
284 ENUM: rlFramebufferAttachTextureType
285 RL_ATTACHMENT_CUBEMAP_POSITIVE_X ! Framebuffer texture attachment type: cubemap, +X side
286 RL_ATTACHMENT_CUBEMAP_NEGATIVE_X ! Framebuffer texture attachment type: cubemap, -X side
287 RL_ATTACHMENT_CUBEMAP_POSITIVE_Y ! Framebuffer texture attachment type: cubemap, +Y side
288 RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y ! Framebuffer texture attachment type: cubemap, -Y side
289 RL_ATTACHMENT_CUBEMAP_POSITIVE_Z ! Framebuffer texture attachment type: cubemap, +Z side
290 RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z ! Framebuffer texture attachment type: cubemap, -Z side
291 { RL_ATTACHMENT_TEXTURE2D 100 } ! Framebuffer texture attachment type: texture2d
292 { RL_ATTACHMENT_RENDERBUFFER 200 } ! Framebuffer texture attachment type: renderbuffer
301 FUNCTION-ALIAS: rl-matrix-mode void rlMatrixMode ( int mode ) ! Choose the current matrix to be transformed
302 FUNCTION-ALIAS: rl-push-matrix void rlPushMatrix ( ) ! Push the current matrix to stack
303 FUNCTION-ALIAS: rl-pop-matrix void rlPopMatrix ( ) ! Pop latest inserted matrix from stack
304 FUNCTION-ALIAS: rl-load-identity void rlLoadIdentity ( ) ! Reset current matrix to identity matrix
305 FUNCTION-ALIAS: rl-translatef void rlTranslatef ( float x, float y, float z ) ! Multiply the current matrix by a translation matrix
306 FUNCTION-ALIAS: rl-rotatef void rlRotatef ( float angle, float x, float y, float z ) ! Multiply the current matrix by a rotation matrix
307 FUNCTION-ALIAS: rl-scalef void rlScalef ( float x, float y, float z ) ! Multiply the current matrix by a scaling matrix
308 FUNCTION-ALIAS: rl-mult-matrixf void rlMultMatrixf ( float* matf ) ! Multiply the current matrix by another matrix
309 FUNCTION-ALIAS: rl-frustum void rlFrustum ( double left, double right, double bottom, double top, double znear, double zfar )
310 FUNCTION-ALIAS: rl-ortho void rlOrtho ( double left, double right, double bottom, double top, double znear, double zfar )
311 FUNCTION-ALIAS: rl-viewport void rlViewport ( int x, int y, int width, int height ) ! Set the viewport area
313 ! ------------------------------------------------------------------------------------
314 ! Functions Declaration - Vertex level operations
315 ! ------------------------------------------------------------------------------------
316 FUNCTION-ALIAS: rl-begin void rlBegin ( int mode ) ! Initialize drawing mode ( how to organize vertex )
317 FUNCTION-ALIAS: rl-end void rlEnd ( ) ! Finish vertex providing
318 FUNCTION-ALIAS: rl-vertex2i void rlVertex2i ( int x, int y ) ! Define one vertex ( position ) - 2 int
319 FUNCTION-ALIAS: rl-vertex2f void rlVertex2f ( float x, float y ) ! Define one vertex ( position ) - 2 float
320 FUNCTION-ALIAS: rl-vertex3f void rlVertex3f ( float x, float y, float z ) ! Define one vertex ( position ) - 3 float
321 FUNCTION-ALIAS: rl-text-coord2f void rlTexCoord2f ( float x, float y ) ! Define one vertex ( texture coordinate ) - 2 float
322 FUNCTION-ALIAS: rl-normal3f void rlNormal3f ( float x, float y, float z ) ! Define one vertex ( normal ) - 3 float
323 FUNCTION-ALIAS: rl-color4ub void rlColor4ub ( uchar r, uchar g, uchar b, uchar a ) ! Define one vertex ( color ) - 4 byte
324 FUNCTION-ALIAS: rl-color3f void rlColor3f ( float x, float y, float z ) ! Define one vertex ( color ) - 3 float
325 FUNCTION-ALIAS: rl-color4f void rlColor4f ( float x, float y, float z, float w ) ! Define one vertex ( color ) - 4 float
327 ! ------------------------------------------------------------------------------------
328 ! Functions Declaration - OpenGL style functions ( common to 1.1, 3.3+, ES2 )
329 ! NOTE: This functions are used to completely abstract raylib code from OpenGL layer,
330 ! some of them are direct wrappers over OpenGL calls, some others are custom
331 ! ------------------------------------------------------------------------------------
333 ! Vertex buffers state
334 FUNCTION-ALIAS: rl-enable-vertex-array bool rlEnableVertexArray ( uint vaoId ) ! Enable vertex array ( VAO, if supported )
335 FUNCTION-ALIAS: rl-disable-vertex-array void rlDisableVertexArray ( ) ! Disable vertex array ( VAO, if supported )
336 FUNCTION-ALIAS: rl-enable-vertex-buffer void rlEnableVertexBuffer ( uint id ) ! Enable vertex buffer ( VBO )
337 FUNCTION-ALIAS: rl-disable-vertex-buffer void rlDisableVertexBuffer ( ) ! Disable vertex buffer ( VBO )
338 FUNCTION-ALIAS: rl-enable-vertex-buffer-element void rlEnableVertexBufferElement ( uint id ) ! Enable vertex buffer element ( VBO element )
339 FUNCTION-ALIAS: rl-disable-vertex-buffer-element void rlDisableVertexBufferElement ( ) ! Disable vertex buffer element ( VBO element )
340 FUNCTION-ALIAS: rl-enable-vertex-attribute void rlEnableVertexAttribute ( uint index ) ! Enable vertex attribute index
341 FUNCTION-ALIAS: rl-disable-vertex-attribute void rlDisableVertexAttribute ( uint index ) ! Disable vertex attribute index
342 ! #if defined ( GRAPHICS_API_OPENGL_11 )
343 ! FUNCTION-ALIAS: void rlEnableStatePointer ( int vertexAttribType, void* buffer ) ! Enable attribute state pointer
344 ! FUNCTION-ALIAS: void rlDisableStatePointer ( int vertexAttribType ) ! Disable attribute state pointer
348 FUNCTION-ALIAS: rl-active-texture-slot void rlActiveTextureSlot ( int slot ) ! Select and active a texture slot
349 FUNCTION-ALIAS: rl-enable-texture void rlEnableTexture ( uint id ) ! Enable texture
350 FUNCTION-ALIAS: rl-disable-texture void rlDisableTexture ( ) ! Disable texture
351 FUNCTION-ALIAS: rl-enable-texture-cubemap void rlEnableTextureCubemap ( uint id ) ! Enable texture cubemap
352 FUNCTION-ALIAS: rl-disable-texture-cubemap void rlDisableTextureCubemap ( ) ! Disable texture cubemap
353 FUNCTION-ALIAS: rl-texture-parameters void rlTextureParameters ( uint id, int param, int value ) ! Set texture parameters ( filter, wrap )
354 FUNCTION-ALIAS: rl-cubemap-parameters void rlCubemapParameters ( uint id, int param, int value ) ! Set cubemap parameters ( filter, wrap )
357 FUNCTION-ALIAS: rl-enable-shader void rlEnableShader ( uint id ) ! Enable shader program
358 FUNCTION-ALIAS: rl-disable-shader void rlDisableShader ( ) ! Disable shader program
361 FUNCTION-ALIAS: rl-enable-framebuffer void rlEnableFramebuffer ( uint id ) ! Enable render texture ( fbo )
362 FUNCTION-ALIAS: rl-disable-framebuffer void rlDisableFramebuffer ( ) ! Disable render texture ( fbo ), return to default framebuffer
363 FUNCTION-ALIAS: rl-activate-draw-buffers void rlActiveDrawBuffers ( int count ) ! Activate multiple draw color buffers
365 ! General render state
366 FUNCTION-ALIAS: rl-enable-color-blend void rlEnableColorBlend ( ) ! Enable color blending
367 FUNCTION-ALIAS: rl-disable-color-blend void rlDisableColorBlend ( ) ! Disable color blending
368 FUNCTION-ALIAS: rl-enble-depth-test void rlEnableDepthTest ( ) ! Enable depth test
369 FUNCTION-ALIAS: rl-disable-depth-test void rlDisableDepthTest ( ) ! Disable depth test
370 FUNCTION-ALIAS: rl-enable-depth-mask void rlEnableDepthMask ( ) ! Enable depth write
371 FUNCTION-ALIAS: rl-disable-depth-mask void rlDisableDepthMask ( ) ! Disable depth write
372 FUNCTION-ALIAS: rl-enable-backface-culling void rlEnableBackfaceCulling ( ) ! Enable backface culling
373 FUNCTION-ALIAS: rl-disable-backface-culling void rlDisableBackfaceCulling ( ) ! Disable backface culling
374 FUNCTION-ALIAS: rl-set-cull-face void rlSetCullFace ( int mode ) ! Set face culling mode
375 FUNCTION-ALIAS: rl-enable-scissor-test void rlEnableScissorTest ( ) ! Enable scissor test
376 FUNCTION-ALIAS: rl-disable-scissor-test void rlDisableScissorTest ( ) ! Disable scissor test
377 FUNCTION-ALIAS: rl-scissor void rlScissor ( int x, int y, int width, int height ) ! Scissor test
378 FUNCTION-ALIAS: rl-enable-wire-mode void rlEnableWireMode ( ) ! Enable wire mode
379 FUNCTION-ALIAS: rl-disable-wire-mode void rlDisableWireMode ( ) ! Disable wire mode
380 FUNCTION-ALIAS: rl-set-line-width void rlSetLineWidth ( float width ) ! Set the line drawing width
381 FUNCTION-ALIAS: rl-get-line-width float rlGetLineWidth ( ) ! Get the line drawing width
382 FUNCTION-ALIAS: rl-enable-smooth-lines void rlEnableSmoothLines ( ) ! Enable line aliasing
383 FUNCTION-ALIAS: rl-disable-smooth-lines void rlDisableSmoothLines ( ) ! Disable line aliasing
384 FUNCTION-ALIAS: rl-enable-stereo-render void rlEnableStereoRender ( ) ! Enable stereo rendering
385 FUNCTION-ALIAS: rl-disable-stereo-render void rlDisableStereoRender ( ) ! Disable stereo rendering
386 FUNCTION-ALIAS: rl-is-stereo-rendering-enabled bool rlIsStereoRenderEnabled ( ) ! Check if stereo render is enabled
388 FUNCTION-ALIAS: rl-clear-color void rlClearColor ( uchar r, uchar g, uchar b, uchar a ) ! Clear color buffer with color
389 FUNCTION-ALIAS: rl-clear-screen-buffers void rlClearScreenBuffers ( ) ! Clear used screen buffers ( color and depth )
390 FUNCTION-ALIAS: rl-check-errors void rlCheckErrors ( ) ! Check and log OpenGL error codes
391 FUNCTION-ALIAS: rl-set-blend-mode void rlSetBlendMode ( int mode ) ! Set blending mode
392 FUNCTION-ALIAS: rl-set-blend-factors void rlSetBlendFactors ( int glSrcFactor, int glDstFactor, int glEquation ) ! Set blending mode factor and equation ( using OpenGL factors )
393 FUNCTION-ALIAS: rl-set-blend-factors-seperate void rlSetBlendFactorsSeparate ( int glSrcRGB, int glDstRGB, int glSrcAlpha, int glDstAlpha, int glEqRGB, int glEqAlpha ) ! Set blending mode factors and equations separately ( using OpenGL factors )
395 ! ------------------------------------------------------------------------------------
396 ! Functions Declaration - rlgl functionality
397 ! ------------------------------------------------------------------------------------
398 ! rlgl initialization functions
399 FUNCTION-ALIAS: rl-gl-init void rlglInit ( int width, int height ) ! Initialize rlgl ( buffers, shaders, textures, states )
400 FUNCTION-ALIAS: rl-gl-close void rlglClose ( ) ! De-initialize rlgl ( buffers, shaders, textures )
401 FUNCTION-ALIAS: rl-load-extensions void rlLoadExtensions ( void* loader ) ! Load OpenGL extensions ( loader function required )
402 FUNCTION-ALIAS: rl-get-version int rlGetVersion ( ) ! Get current OpenGL version
403 FUNCTION-ALIAS: rl-set-framebuffer-width void rlSetFramebufferWidth ( int width ) ! Set current framebuffer width
404 FUNCTION-ALIAS: rl-get-framebuffer-width int rlGetFramebufferWidth ( ) ! Get default framebuffer width
405 FUNCTION-ALIAS: rl-set-framebuffer-height void rlSetFramebufferHeight ( int height ) ! Set current framebuffer height
406 FUNCTION-ALIAS: rl-get-framebuffer-height int rlGetFramebufferHeight ( ) ! Get default framebuffer height
408 FUNCTION-ALIAS: rl-get-texture-id-default uint rlGetTextureIdDefault ( ) ! Get default texture id
409 FUNCTION-ALIAS: rl-get-shader-id-default uint rlGetShaderIdDefault ( ) ! Get default shader id
410 FUNCTION-ALIAS: rl-get-shader-locs-default int* rlGetShaderLocsDefault ( ) ! Get default shader locations
412 ! Render batch management
413 ! NOTE: rlgl provides a default render batch to behave like OpenGL 1.1 immediate mode
414 ! but this render batch API is exposed in case of custom batches are required
415 FUNCTION-ALIAS: rl-load-render-batch rlRenderBatch rlLoadRenderBatch ( int numBuffers, int bufferElements ) ! Load a render batch system
416 FUNCTION-ALIAS: rl-unload-render-batch void rlUnloadRenderBatch ( rlRenderBatch batch ) ! Unload render batch system
417 FUNCTION-ALIAS: rl-draw-render-batch void rlDrawRenderBatch ( rlRenderBatch* batch ) ! Draw render batch data ( Update->Draw->Reset )
418 FUNCTION-ALIAS: rl-set-render-batch-active void rlSetRenderBatchActive ( rlRenderBatch* batch ) ! Set the active render batch for rlgl ( NULL for default internal )
419 FUNCTION-ALIAS: rl-draw-render-batch-active void rlDrawRenderBatchActive ( ) ! Update and draw internal render batch
420 FUNCTION-ALIAS: rl-check-render-batch-limit bool rlCheckRenderBatchLimit ( int vCount ) ! Check internal buffer overflow for a given number of vertex
422 FUNCTION-ALIAS: rl-set-texture void rlSetTexture ( uint id ) ! Set current texture for render batch and check buffers limits
424 ! ------------------------------------------------------------------------------------------------------------------------
426 ! Vertex buffers management
427 FUNCTION-ALIAS: rl-load-vertex-array uint rlLoadVertexArray ( ) ! Load vertex array ( vao ) if supported
428 FUNCTION-ALIAS: rl-load-vertex-buffer uint rlLoadVertexBuffer ( void* buffer, int size, bool dynamic ) ! Load a vertex buffer attribute
429 FUNCTION-ALIAS: rl-load-vertex-buffer-element uint rlLoadVertexBufferElement ( void* buffer, int size, bool dynamic ) ! Load a new attributes element buffer
430 FUNCTION-ALIAS: rl-update-vetex-buffer void rlUpdateVertexBuffer ( uint bufferId, void* data, int dataSize, int offset ) ! Update GPU buffer with new data
431 FUNCTION-ALIAS: rl-update-vetex-buffer-elements void rlUpdateVertexBufferElements ( uint id, void* data, int dataSize, int offset ) ! Update vertex buffer elements with new data
432 FUNCTION-ALIAS: rl-unload-vertex-array void rlUnloadVertexArray ( uint vaoId )
433 FUNCTION-ALIAS: rl-unload-vertex-buffer void rlUnloadVertexBuffer ( uint vboId )
434 FUNCTION-ALIAS: rl-set-vertex-attribute void rlSetVertexAttribute ( uint index, int compSize, int type, bool normalized, int stride, void* pointer )
435 FUNCTION-ALIAS: rl-set-vertex-attribute-divisor void rlSetVertexAttributeDivisor ( uint index, int divisor )
436 FUNCTION-ALIAS: rl-set-vertex-attribute-default void rlSetVertexAttributeDefault ( int locIndex, void* value, int attribType, int count ) ! Set vertex attribute default value
437 FUNCTION-ALIAS: rl-draw-vertex-array void rlDrawVertexArray ( int offset, int count )
438 FUNCTION-ALIAS: rl-draw-vertex-array-elements void rlDrawVertexArrayElements ( int offset, int count, void* buffer )
439 FUNCTION-ALIAS: rl-draw-vertex-array-instanced void rlDrawVertexArrayInstanced ( int offset, int count, int instances )
440 FUNCTION-ALIAS: rl-draw-vertex-array-elements-instanced void rlDrawVertexArrayElementsInstanced ( int offset, int count, void* buffer, int instances )
442 ! Textures management
443 FUNCTION-ALIAS: rl-load-texture uint rlLoadTexture ( void* data, int width, int height, int format, int mipmapCount ) ! Load texture in GPU
444 FUNCTION-ALIAS: rl-load-texture-depth uint rlLoadTextureDepth ( int width, int height, bool useRenderBuffer ) ! Load depth texture/renderbuffer ( to be attached to fbo )
445 FUNCTION-ALIAS: rl-load-texture-cubemap uint rlLoadTextureCubemap ( void* data, int size, int format ) ! Load texture cubemap
446 FUNCTION-ALIAS: rl-update-texture void rlUpdateTexture ( uint id, int offsetX, int offsetY, int width, int height, int format, void* data ) ! Update GPU texture with new data
447 FUNCTION-ALIAS: rl-get-gl-texture-formats void rlGetGlTextureFormats ( int format, uint* glInternalFormat, uint* glFormat, uint* glType ) ! Get OpenGL internal formats
448 FUNCTION-ALIAS: rl-get-pixel-format-name char* rlGetPixelFormatName ( uint format ) ! Get name string for pixel format
449 FUNCTION-ALIAS: rl-unload-texture void rlUnloadTexture ( uint id ) ! Unload texture from GPU memory
450 FUNCTION-ALIAS: rl-gen-texture-mipmaps void rlGenTextureMipmaps ( uint id, int width, int height, int format, int* mipmaps ) ! Generate mipmap data for selected texture
451 FUNCTION-ALIAS: rl-read-texture-pixels void* rlReadTexturePixels ( uint id, int width, int height, int format ) ! Read texture pixel data
452 FUNCTION-ALIAS: rl-read-screen-pixels uchar* rlReadScreenPixels ( int width, int height ) ! Read screen pixel data ( color buffer )
454 ! Framebuffer management ( fbo )
455 FUNCTION-ALIAS: rl-load-framebuffer uint rlLoadFramebuffer ( int width, int height ) ! Load an empty framebuffer
456 FUNCTION-ALIAS: rl-framebuffer-attach void rlFramebufferAttach ( uint fboId, uint texId, int attachType, int texType, int mipLevel ) ! Attach texture/renderbuffer to a framebuffer
457 FUNCTION-ALIAS: rl-framebuffer-complete bool rlFramebufferComplete ( uint id ) ! Verify framebuffer is complete
458 FUNCTION-ALIAS: rl-unload-framebuffer void rlUnloadFramebuffer ( uint id ) ! Delete framebuffer from GPU
461 FUNCTION-ALIAS: rl-load-shader-code uint rlLoadShaderCode ( char* vsCode, char* fsCode ) ! Load shader from code strings
462 FUNCTION-ALIAS: rl-compile-shader uint rlCompileShader ( char* shaderCode, int type ) ! Compile custom shader and return shader id ( type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER )
463 FUNCTION-ALIAS: rl-load-shader-program uint rlLoadShaderProgram ( uint vShaderId, uint fShaderId ) ! Load custom shader program
464 FUNCTION-ALIAS: rl-unload-shader-program void rlUnloadShaderProgram ( uint id ) ! Unload shader program
465 FUNCTION-ALIAS: rl-get-location-uniform int rlGetLocationUniform ( uint shaderId, char* uniformName ) ! Get shader location uniform
466 FUNCTION-ALIAS: rl-get-location-attrib int rlGetLocationAttrib ( uint shaderId, char* attribName ) ! Get shader location attribute
467 FUNCTION-ALIAS: rl-set-uniform void rlSetUniform ( int locIndex, void* value, int uniformType, int count ) ! Set shader value uniform
468 FUNCTION-ALIAS: rl-set-uniform-matrix void rlSetUniformMatrix ( int locIndex, Matrix mat ) ! Set shader value matrix
469 FUNCTION-ALIAS: rl-set-uniform-sampler void rlSetUniformSampler ( int locIndex, uint textureId ) ! Set shader value sampler
470 FUNCTION-ALIAS: rl-set-shader void rlSetShader ( uint id, int* locs ) ! Set shader currently active ( id and locations )
472 ! Compute shader management
473 FUNCTION-ALIAS: rl-load-compute-shader-program uint rlLoadComputeShaderProgram ( uint shaderId ) ! Load compute shader program
474 FUNCTION-ALIAS: rl-compute-shader-dispatch void rlComputeShaderDispatch ( uint groupX, uint groupY, uint groupZ ) ! Dispatch compute shader ( equivalent to* draw* for graphics pipeline )
476 ! Shader buffer storage object management ( ssbo )
477 FUNCTION-ALIAS: rl-load-shader-buffer uint rlLoadShaderBuffer ( uint size, void* data, int usageHint ) ! Load shader storage buffer object ( SSBO )
478 FUNCTION-ALIAS: rl-unload-shader-buffer void rlUnloadShaderBuffer ( uint ssboId ) ! Unload shader storage buffer object ( SSBO )
479 FUNCTION-ALIAS: rl-update-shader-buffer void rlUpdateShaderBuffer ( uint id, void* data, uint dataSize, uint offset ) ! Update SSBO buffer data
480 FUNCTION-ALIAS: rl-bind-shader-buffer void rlBindShaderBuffer ( uint id, uint index ) ! Bind SSBO buffer
481 FUNCTION-ALIAS: rl-read-shader-buffer void rlReadShaderBuffer ( uint id, void* dest, uint count, uint offset ) ! Read SSBO buffer data ( GPU->CPU )
482 FUNCTION-ALIAS: rl-copy-shader-buffer void rlCopyShaderBuffer ( uint destId, uint srcId, uint destOffset, uint srcOffset, uint count ) ! Copy SSBO data between buffers
483 FUNCTION-ALIAS: rl-get-shader-buffer-size uint rlGetShaderBufferSize ( uint id ) ! Get SSBO buffer size
486 FUNCTION-ALIAS: rl-bind-image-texture void rlBindImageTexture ( uint id, uint index, int format, bool readonly ) ! Bind image texture
488 ! Matrix state management
489 FUNCTION-ALIAS: rl-get-matrix-modelview Matrix rlGetMatrixModelview ( ) ! Get internal modelview matrix
490 FUNCTION-ALIAS: rl-get-matrix-projection Matrix rlGetMatrixProjection ( ) ! Get internal projection matrix
491 FUNCTION-ALIAS: rl-get-matrix-transform Matrix rlGetMatrixTransform ( ) ! Get internal accumulated transform matrix
492 FUNCTION-ALIAS: rl-get-matrix-projection-stereo Matrix rlGetMatrixProjectionStereo ( int eye ) ! Get internal projection matrix for stereo render ( selected eye )
493 FUNCTION-ALIAS: rl-get-matrix-view-offset-stereo Matrix rlGetMatrixViewOffsetStereo ( int eye ) ! Get internal view offset matrix for stereo render ( selected eye )
494 FUNCTION-ALIAS: rl-set-matrix-projection void rlSetMatrixProjection ( Matrix proj ) ! Set a custom projection matrix ( replaces internal projection matrix )
495 FUNCTION-ALIAS: rl-set-matrix-modelview void rlSetMatrixModelview ( Matrix view ) ! Set a custom modelview matrix ( replaces internal modelview matrix )
496 FUNCTION-ALIAS: rl-set-matrix-projection-stereo void rlSetMatrixProjectionStereo ( Matrix right, Matrix left ) ! Set eyes projection matrices for stereo rendering
497 FUNCTION-ALIAS: rl-set-matrix-view-offset-stereo void rlSetMatrixViewOffsetStereo ( Matrix right, Matrix left ) ! Set eyes view offsets matrices for stereo rendering
499 ! Quick and dirty cube/quad buffers load->draw->unload
500 FUNCTION-ALIAS: rl-load-draw-cube void rlLoadDrawCube ( ) ! Load and draw a cube
501 FUNCTION-ALIAS: rl-load-draw-quad void rlLoadDrawQuad ( ) ! Load and draw a quad