summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--API.md276
-rw-r--r--ReiLua_API.lua151
-rw-r--r--changelog2
-rw-r--r--include/lgl.h13
-rw-r--r--include/lua_core.h1
-rw-r--r--src/gl.c153
-rw-r--r--src/lua_core.c61
7 files changed, 641 insertions, 16 deletions
diff --git a/API.md b/API.md
index 42af261..04517ed 100644
--- a/API.md
+++ b/API.md
@@ -3337,7 +3337,7 @@ Framebuffer texture attachment type: renderbuffer
---
-## Defines - OpenGL
+## Defines - OpenGL Bitfield mask
> GL_COLOR_BUFFER_BIT = 16384
---
@@ -3350,6 +3350,8 @@ Framebuffer texture attachment type: renderbuffer
---
+
+## Defines - OpenGL Texture parameter
> GL_NEAREST = 9728
---
@@ -3359,7 +3361,209 @@ Framebuffer texture attachment type: renderbuffer
---
-## Defines - CBuffer Data types
+## Defines - OpenGL Capability
+> GL_BLEND = 3042
+
+If enabled, blend the computed fragment color values with the values in the color buffers. See glBlendFunc
+
+---
+
+> GL_CULL_FACE = 2884
+
+If enabled, cull polygons based on their winding in window coordinates. See glCullFace
+
+---
+
+> GL_DEPTH_TEST = 2929
+
+If enabled, do depth comparisons and update the depth buffer. Note that even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. See glDepthFunc and glDepthRangef
+
+---
+
+> GL_DITHER = 3024
+
+If enabled, dither color components or indices before they are written to the color buffer
+
+---
+
+> GL_POLYGON_OFFSET_FILL = 32823
+
+If enabled, an offset is added to depth values of a polygon's fragments produced by rasterization. See glPolygonOffset
+
+---
+
+> GL_SAMPLE_ALPHA_TO_COVERAGE = 32926
+
+If enabled, compute a temporary coverage value where each bit is determined by the alpha value at the corresponding sample location. The temporary coverage value is then ANDed with the fragment coverage value
+
+---
+
+> GL_SAMPLE_COVERAGE = 32928
+
+If enabled, the fragment's coverage is ANDed with the temporary coverage value. If GL_SAMPLE_COVERAGE_INVERT is set to GL_TRUE, invert the coverage value. See glSampleCoverage
+
+---
+
+> GL_SCISSOR_TEST = 3089
+
+If enabled, discard fragments that are outside the scissor rectangle. See glScissor
+
+---
+
+> GL_STENCIL_TEST = 2960
+
+If enabled, do stencil testing and update the stencil buffer. See glStencilFunc and glStencilOp
+
+---
+
+
+## Defines - OpenGL Test function
+> GL_NEVER = 512
+
+Always fails
+
+---
+
+> GL_LESS = 513
+
+Passes if ( ref & mask ) < ( stencil & mask )
+
+---
+
+> GL_LEQUAL = 515
+
+Passes if ( ref & mask ) <= ( stencil & mask )
+
+---
+
+> GL_GREATER = 516
+
+Passes if ( ref & mask ) > ( stencil & mask )
+
+---
+
+> GL_GEQUAL = 518
+
+Passes if ( ref & mask ) >= ( stencil & mask )
+
+---
+
+> GL_EQUAL = 514
+
+Passes if ( ref & mask ) = ( stencil & mask )
+
+---
+
+> GL_NOTEQUAL = 517
+
+Passes if ( ref & mask ) != ( stencil & mask )
+
+---
+
+> GL_ALWAYS = 519
+
+Always passes
+
+---
+
+
+## Defines - OpenGL Face
+> GL_FRONT = 1028
+
+---
+
+> GL_BACK = 1029
+
+---
+
+> GL_FRONT_AND_BACK = 1032
+
+---
+
+
+## Defines - OpenGL Stencil test
+> GL_KEEP = 7680
+
+Keeps the current value
+
+---
+
+> GL_ZERO = 0
+
+Sets the stencil buffer value to 0
+
+---
+
+> GL_REPLACE = 7681
+
+Sets the stencil buffer value to ref, as specified by glStencilFunc
+
+---
+
+> GL_INCR = 7682
+
+Increments the current stencil buffer value. Clamps to the maximum representable unsigned value
+
+---
+
+> GL_INCR_WRAP = 34055
+
+Increments the current stencil buffer value. Wraps stencil buffer value to zero when incrementing the maximum representable unsigned value
+
+---
+
+> GL_DECR = 7683
+
+Decrements the current stencil buffer value. Clamps to 0
+
+---
+
+> GL_DECR_WRAP = 34056
+
+Decrements the current stencil buffer value. Wraps stencil buffer value to the maximum representable unsigned value when decrementing a stencil buffer value of zero
+
+---
+
+> GL_INVERT = 5386
+
+Bitwise inverts the current stencil buffer value
+
+---
+
+
+## Defines - OpenGL Connection
+> GL_VENDOR = 7936
+
+Returns the company responsible for this GL implementation. This name does not change from release to release
+
+---
+
+> GL_RENDERER = 7937
+
+Returns the name of the renderer. This name is typically specific to a particular configuration of a hardware platform. It does not change from release to release
+
+---
+
+> GL_VERSION = 7938
+
+Returns a version or release number of the form OpenGLES
+
+---
+
+> GL_SHADING_LANGUAGE_VERSION = 35724
+
+Returns a version or release number for the shading language of the form OpenGLESGLSLES
+
+---
+
+> GL_EXTENSIONS = 7939
+
+Returns a space-separated list of supported extensions to GL
+
+---
+
+
+## Defines - CBuffer Data type
> BUFFER_UNSIGNED_CHAR = 0
C type unsigned char
@@ -10585,14 +10789,78 @@ Set eyes view offsets matrices for stereo rendering
---
-## OpenGL - Framebuffer management
+## OpenGL - Frame Buffers
---
> RL.glBlitFramebuffer( RenderTexture srcTex, RenderTexture dstTex, Rectangle srcRect, Rectangle dstRect, int mask, int filter )
Copy a block of pixels from one framebuffer object to another.
-Use -1 RenderTexture for window framebuffer
+Use nil RenderTexture for window framebuffer
+
+---
+
+## OpenGL - State Management
+
+---
+
+> RL.glEnable( int cap )
+
+Enable server-side GL capabilities
+
+---
+
+> RL.glDisable( int cap )
+
+Disable server-side GL capabilities
+
+---
+
+> RL.glStencilFunc( int func, int ref, int mask )
+
+Set front and back function and reference value for stencil testing
+
+---
+
+> RL.glStencilFuncSeparate( int face, int func, int ref, int mask )
+
+Set front and/or back function and reference value for stencil testing
+
+---
+
+> RL.glStencilMask( int mask )
+
+Control the front and back writing of individual bits in the stencil planes
+
+---
+
+> RL.glStencilMaskSeparate( int face, int mask )
+
+Control the front and/or back writing of individual bits in the stencil planes
+
+---
+
+> RL.glStencilOp( int sfail, int dpfail, int dppass )
+
+Set front and back stencil test actions
+
+---
+
+> RL.glStencilOpSeparate( int face, int sfail, int dpfail, int dppass )
+
+Set front and back stencil test actions
+
+---
+
+## OpenGL - Utility
+
+---
+
+> connection = RL.glGetString( int name, int|nil index )
+
+Return a string describing the current GL connection. GL_EXTENSIONS returns the extension string supported by the implementation at index
+
+- Success return string
---
diff --git a/ReiLua_API.lua b/ReiLua_API.lua
index aa2e956..3a4c034 100644
--- a/ReiLua_API.lua
+++ b/ReiLua_API.lua
@@ -1156,15 +1156,96 @@ RL.RL_ATTACHMENT_RENDERBUFFER=200
RL.RL_CULL_FACE_FRONT=0
RL.RL_CULL_FACE_BACK=1
--- Defines - OpenGL
+-- Defines - OpenGL Bitfield mask
RL.GL_COLOR_BUFFER_BIT=16384
RL.GL_DEPTH_BUFFER_BIT=256
RL.GL_STENCIL_BUFFER_BIT=1024
+
+-- Defines - OpenGL Texture parameter
+
RL.GL_NEAREST=9728
RL.GL_LINEAR=9729
--- Defines - CBuffer Data types
+-- Defines - OpenGL Capability
+
+---If enabled, blend the computed fragment color values with the values in the color buffers. See glBlendFunc
+RL.GL_BLEND=3042
+---If enabled, cull polygons based on their winding in window coordinates. See glCullFace
+RL.GL_CULL_FACE=2884
+---If enabled, do depth comparisons and update the depth buffer. Note that even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. See glDepthFunc and glDepthRangef
+RL.GL_DEPTH_TEST=2929
+---If enabled, dither color components or indices before they are written to the color buffer
+RL.GL_DITHER=3024
+---If enabled, an offset is added to depth values of a polygon's fragments produced by rasterization. See glPolygonOffset
+RL.GL_POLYGON_OFFSET_FILL=32823
+---If enabled, compute a temporary coverage value where each bit is determined by the alpha value at the corresponding sample location. The temporary coverage value is then ANDed with the fragment coverage value
+RL.GL_SAMPLE_ALPHA_TO_COVERAGE=32926
+---If enabled, the fragment's coverage is ANDed with the temporary coverage value. If GL_SAMPLE_COVERAGE_INVERT is set to GL_TRUE, invert the coverage value. See glSampleCoverage
+RL.GL_SAMPLE_COVERAGE=32928
+---If enabled, discard fragments that are outside the scissor rectangle. See glScissor
+RL.GL_SCISSOR_TEST=3089
+---If enabled, do stencil testing and update the stencil buffer. See glStencilFunc and glStencilOp
+RL.GL_STENCIL_TEST=2960
+
+-- Defines - OpenGL Test function
+
+---Always fails
+RL.GL_NEVER=512
+---Passes if ( ref & mask ) < ( stencil & mask )
+RL.GL_LESS=513
+---Passes if ( ref & mask ) <= ( stencil & mask )
+RL.GL_LEQUAL=515
+---Passes if ( ref & mask ) > ( stencil & mask )
+RL.GL_GREATER=516
+---Passes if ( ref & mask ) >= ( stencil & mask )
+RL.GL_GEQUAL=518
+---Passes if ( ref & mask ) = ( stencil & mask )
+RL.GL_EQUAL=514
+---Passes if ( ref & mask ) != ( stencil & mask )
+RL.GL_NOTEQUAL=517
+---Always passes
+RL.GL_ALWAYS=519
+
+-- Defines - OpenGL Face
+
+RL.GL_FRONT=1028
+RL.GL_BACK=1029
+RL.GL_FRONT_AND_BACK=1032
+
+-- Defines - OpenGL Stencil test
+
+---Keeps the current value
+RL.GL_KEEP=7680
+---Sets the stencil buffer value to 0
+RL.GL_ZERO=0
+---Sets the stencil buffer value to ref, as specified by glStencilFunc
+RL.GL_REPLACE=7681
+---Increments the current stencil buffer value. Clamps to the maximum representable unsigned value
+RL.GL_INCR=7682
+---Increments the current stencil buffer value. Wraps stencil buffer value to zero when incrementing the maximum representable unsigned value
+RL.GL_INCR_WRAP=34055
+---Decrements the current stencil buffer value. Clamps to 0
+RL.GL_DECR=7683
+---Decrements the current stencil buffer value. Wraps stencil buffer value to the maximum representable unsigned value when decrementing a stencil buffer value of zero
+RL.GL_DECR_WRAP=34056
+---Bitwise inverts the current stencil buffer value
+RL.GL_INVERT=5386
+
+-- Defines - OpenGL Connection
+
+---Returns the company responsible for this GL implementation. This name does not change from release to release
+RL.GL_VENDOR=7936
+---Returns the name of the renderer. This name is typically specific to a particular configuration of a hardware platform. It does not change from release to release
+RL.GL_RENDERER=7937
+---Returns a version or release number of the form OpenGLES
+RL.GL_VERSION=7938
+---Returns a version or release number for the shading language of the form OpenGLESGLSLES
+RL.GL_SHADING_LANGUAGE_VERSION=35724
+---Returns a space-separated list of supported extensions to GL
+RL.GL_EXTENSIONS=7939
+
+-- Defines - CBuffer Data type
---C type unsigned char
RL.BUFFER_UNSIGNED_CHAR=0
@@ -7507,10 +7588,10 @@ function RL.rlSetMatrixProjectionStereo( right, left ) end
---@return any RL.rlSetMatrixViewOffsetStereo
function RL.rlSetMatrixViewOffsetStereo( right, left ) end
--- OpenGL - Framebuffer management
+-- OpenGL - Frame Buffers
---Copy a block of pixels from one framebuffer object to another.
----Use -1 RenderTexture for window framebuffer
+---Use nil RenderTexture for window framebuffer
---@param srcTex any
---@param dstTex any
---@param srcRect table
@@ -7520,6 +7601,68 @@ function RL.rlSetMatrixViewOffsetStereo( right, left ) end
---@return any RL.glBlitFramebuffer
function RL.glBlitFramebuffer( srcTex, dstTex, srcRect, dstRect, mask, filter ) end
+-- OpenGL - State Management
+
+---Enable server-side GL capabilities
+---@param cap integer
+---@return any RL.glEnable
+function RL.glEnable( cap ) end
+
+---Disable server-side GL capabilities
+---@param cap integer
+---@return any RL.glDisable
+function RL.glDisable( cap ) end
+
+---Set front and back function and reference value for stencil testing
+---@param func integer
+---@param ref integer
+---@param mask integer
+---@return any RL.glStencilFunc
+function RL.glStencilFunc( func, ref, mask ) end
+
+---Set front and/or back function and reference value for stencil testing
+---@param face integer
+---@param func integer
+---@param ref integer
+---@param mask integer
+---@return any RL.glStencilFuncSeparate
+function RL.glStencilFuncSeparate( face, func, ref, mask ) end
+
+---Control the front and back writing of individual bits in the stencil planes
+---@param mask integer
+---@return any RL.glStencilMask
+function RL.glStencilMask( mask ) end
+
+---Control the front and/or back writing of individual bits in the stencil planes
+---@param face integer
+---@param mask integer
+---@return any RL.glStencilMaskSeparate
+function RL.glStencilMaskSeparate( face, mask ) end
+
+---Set front and back stencil test actions
+---@param sfail integer
+---@param dpfail integer
+---@param dppass integer
+---@return any RL.glStencilOp
+function RL.glStencilOp( sfail, dpfail, dppass ) end
+
+---Set front and back stencil test actions
+---@param face integer
+---@param sfail integer
+---@param dpfail integer
+---@param dppass integer
+---@return any RL.glStencilOpSeparate
+function RL.glStencilOpSeparate( face, sfail, dpfail, dppass ) end
+
+-- OpenGL - Utility
+
+---Return a string describing the current GL connection. GL_EXTENSIONS returns the extension string supported by the implementation at index
+---- Success return string
+---@param name integer
+---@param index integer|nil
+---@return any connection
+function RL.glGetString( name, index ) end
+
-- Easings - Linear Easing functions
---Ease linear
diff --git a/changelog b/changelog
index 5fe4b68..e9c71d5 100644
--- a/changelog
+++ b/changelog
@@ -6,6 +6,7 @@ KEY CHANGES:
- ADDED: apiScanner.lua for searching unimplemented functions from raylib.
- ADDED Automation events.
- CHANGE: Raygui lib callbacks to single table.
+ - ADDED OpenGL Stencil management functions.
DETAILED CHANGES:
- ADDED: GetBufferElementSize and GetBufferLength.
@@ -38,6 +39,7 @@ DETAILED CHANGES:
- ADDED: Raygui lib tree view.
- ADDED: Raygui lib examples file browser.
- CHANGE: Position argument added for GetCodepoint, GetCodepointNext and GetCodepointPrevious.
+ - ADDED glEnable, glDisable and glGetString.
------------------------------------------------------------------------
Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0
diff --git a/include/lgl.h b/include/lgl.h
index 451f595..5d0ea9b 100644
--- a/include/lgl.h
+++ b/include/lgl.h
@@ -1,4 +1,15 @@
#pragma once
-/* Framebuffer management. */
+/* Frame Buffers. */
int lglBlitFramebuffer( lua_State* L );
+/* State Management. */
+int lglEnable( lua_State* L );
+int lglDisable( lua_State* L );
+int lglStencilFunc( lua_State* L );
+int lglStencilFuncSeparate( lua_State* L );
+int lglStencilMask( lua_State* L );
+int lglStencilMaskSeparate( lua_State* L );
+int lglStencilOp( lua_State* L );
+int lglStencilOpSeparate( lua_State* L );
+/* Utility. */
+int lglGetString( lua_State* L );
diff --git a/include/lua_core.h b/include/lua_core.h
index 586f587..9deb44f 100644
--- a/include/lua_core.h
+++ b/include/lua_core.h
@@ -104,3 +104,4 @@ void uluaPushAutomationEvent( lua_State* L, AutomationEvent event );
void uluaPushAutomationEventList( lua_State* L, AutomationEventList eventList );
/* Utils. */
int uluaGetTableLen( lua_State* L, int index );
+bool uluaIsNil( lua_State* L, int index );
diff --git a/src/gl.c b/src/gl.c
index dfc2a47..40e089b 100644
--- a/src/gl.c
+++ b/src/gl.c
@@ -5,17 +5,17 @@
#include "lgl.h"
/*
-## OpenGL - Framebuffer management
+## OpenGL - Frame Buffers
*/
/*
> RL.glBlitFramebuffer( RenderTexture srcTex, RenderTexture dstTex, Rectangle srcRect, Rectangle dstRect, int mask, int filter )
Copy a block of pixels from one framebuffer object to another.
-Use -1 RenderTexture for window framebuffer
+Use nil RenderTexture for window framebuffer
*/
int lglBlitFramebuffer( lua_State* L ) {
-#if defined( PLATFORM_DESKTOP ) || defined( PLATFORM_DESKTOP_SDL )
+// #if defined( PLATFORM_DESKTOP ) || defined( PLATFORM_DESKTOP_SDL )
if ( !( lua_isuserdata( L, 1 ) || lua_isnil( L, 1 ) ) || !( lua_isuserdata( L, 2 ) || lua_isnil( L, 2 ) ) ) {
TraceLog( state->logLevelInvalid, "%s", "Argument needs to be RenderTexture or nil" );
lua_pushnil( L );
@@ -53,5 +53,150 @@ int lglBlitFramebuffer( lua_State* L ) {
glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 );
return 1;
-#endif
+// #endif
+}
+
+/*
+## OpenGL - State Management
+*/
+
+/*
+> RL.glEnable( int cap )
+
+Enable server-side GL capabilities
+*/
+int lglEnable( lua_State* L ) {
+ int cap = luaL_checkinteger( L, 1 );
+
+ glEnable( cap );
+
+ return 0;
+}
+
+/*
+> RL.glDisable( int cap )
+
+Disable server-side GL capabilities
+*/
+int lglDisable( lua_State* L ) {
+ int cap = luaL_checkinteger( L, 1 );
+
+ glDisable( cap );
+
+ return 0;
+}
+
+/*
+> RL.glStencilFunc( int func, int ref, int mask )
+
+Set front and back function and reference value for stencil testing
+*/
+int lglStencilFunc( lua_State* L ) {
+ int func = luaL_checkinteger( L, 1 );
+ int ref = luaL_checkinteger( L, 2 );
+ unsigned int mask = luaL_checkinteger( L, 3 );
+
+ glStencilFunc( func, ref, mask );
+
+ return 0;
+}
+
+/*
+> RL.glStencilFuncSeparate( int face, int func, int ref, int mask )
+
+Set front and/or back function and reference value for stencil testing
+*/
+int lglStencilFuncSeparate( lua_State* L ) {
+ int face = luaL_checkinteger( L, 1 );
+ int func = luaL_checkinteger( L, 2 );
+ int ref = luaL_checkinteger( L, 3 );
+ unsigned int mask = luaL_checkinteger( L, 4 );
+
+ glStencilFuncSeparate( face, func, ref, mask );
+
+ return 0;
+}
+
+/*
+> RL.glStencilMask( int mask )
+
+Control the front and back writing of individual bits in the stencil planes
+*/
+int lglStencilMask( lua_State* L ) {
+ unsigned int mask = luaL_checkinteger( L, 1 );
+
+ glStencilMask( mask );
+
+ return 0;
+}
+
+/*
+> RL.glStencilMaskSeparate( int face, int mask )
+
+Control the front and/or back writing of individual bits in the stencil planes
+*/
+int lglStencilMaskSeparate( lua_State* L ) {
+ int face = luaL_checkinteger( L, 1 );
+ unsigned int mask = luaL_checkinteger( L, 2 );
+
+ glStencilMaskSeparate( face, mask );
+
+ return 0;
+}
+
+/*
+> RL.glStencilOp( int sfail, int dpfail, int dppass )
+
+Set front and back stencil test actions
+*/
+int lglStencilOp( lua_State* L ) {
+ int sfail = luaL_checkinteger( L, 1 );
+ int dpfail = luaL_checkinteger( L, 2 );
+ int dppass = luaL_checkinteger( L, 3 );
+
+ glStencilOp( sfail, dpfail, dppass );
+
+ return 0;
+}
+
+/*
+> RL.glStencilOpSeparate( int face, int sfail, int dpfail, int dppass )
+
+Set front and back stencil test actions
+*/
+int lglStencilOpSeparate( lua_State* L ) {
+ int face = luaL_checkinteger( L, 1 );
+ int sfail = luaL_checkinteger( L, 2 );
+ int dpfail = luaL_checkinteger( L, 3 );
+ int dppass = luaL_checkinteger( L, 4 );
+
+ glStencilOpSeparate( face, sfail, dpfail, dppass );
+
+ return 0;
+}
+
+/*
+## OpenGL - Utility
+*/
+
+/*
+> connection = RL.glGetString( int name, int|nil index )
+
+Return a string describing the current GL connection. GL_EXTENSIONS returns the extension string supported by the implementation at index
+
+- Success return string
+*/
+int lglGetString( lua_State* L ) {
+ int name = luaL_checkinteger( L, 1 );
+
+ if ( uluaIsNil( L, 2 ) ) {
+ lua_pushstring( L, glGetString( name ) );
+ }
+ else {
+ int index = luaL_checkinteger( L, 2 );
+
+ lua_pushstring( L, glGetStringi( name, index ) );
+ }
+
+ return 1;
}
diff --git a/src/lua_core.c b/src/lua_core.c
index d632897..a65a906 100644
--- a/src/lua_core.c
+++ b/src/lua_core.c
@@ -968,13 +968,52 @@ static void defineGlobals() {
/* RLGL CullMode */
assignGlobalInt( RL_CULL_FACE_FRONT, "RL_CULL_FACE_FRONT" );
assignGlobalInt( RL_CULL_FACE_BACK, "RL_CULL_FACE_BACK" );
- /* OpenGL */
+ /* OpenGL Bitfield mask */
assignGlobalInt( GL_COLOR_BUFFER_BIT, "GL_COLOR_BUFFER_BIT" );
assignGlobalInt( GL_DEPTH_BUFFER_BIT, "GL_DEPTH_BUFFER_BIT" );
assignGlobalInt( GL_STENCIL_BUFFER_BIT, "GL_STENCIL_BUFFER_BIT" );
+ /* OpenGL Texture parameter */
assignGlobalInt( GL_NEAREST, "GL_NEAREST" );
assignGlobalInt( GL_LINEAR, "GL_LINEAR" );
- /* CBuffer Data types */
+ /* OpenGL Capability */
+ assignGlobalInt( GL_BLEND, "GL_BLEND" ); // If enabled, blend the computed fragment color values with the values in the color buffers. See glBlendFunc
+ assignGlobalInt( GL_CULL_FACE, "GL_CULL_FACE" ); // If enabled, cull polygons based on their winding in window coordinates. See glCullFace
+ assignGlobalInt( GL_DEPTH_TEST, "GL_DEPTH_TEST" ); // If enabled, do depth comparisons and update the depth buffer. Note that even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. See glDepthFunc and glDepthRangef
+ assignGlobalInt( GL_DITHER, "GL_DITHER" ); // If enabled, dither color components or indices before they are written to the color buffer
+ assignGlobalInt( GL_POLYGON_OFFSET_FILL, "GL_POLYGON_OFFSET_FILL" ); // If enabled, an offset is added to depth values of a polygon's fragments produced by rasterization. See glPolygonOffset
+ assignGlobalInt( GL_SAMPLE_ALPHA_TO_COVERAGE, "GL_SAMPLE_ALPHA_TO_COVERAGE" ); // If enabled, compute a temporary coverage value where each bit is determined by the alpha value at the corresponding sample location. The temporary coverage value is then ANDed with the fragment coverage value
+ assignGlobalInt( GL_SAMPLE_COVERAGE, "GL_SAMPLE_COVERAGE" ); // If enabled, the fragment's coverage is ANDed with the temporary coverage value. If GL_SAMPLE_COVERAGE_INVERT is set to GL_TRUE, invert the coverage value. See glSampleCoverage
+ assignGlobalInt( GL_SCISSOR_TEST, "GL_SCISSOR_TEST" ); // If enabled, discard fragments that are outside the scissor rectangle. See glScissor
+ assignGlobalInt( GL_STENCIL_TEST, "GL_STENCIL_TEST" ); // If enabled, do stencil testing and update the stencil buffer. See glStencilFunc and glStencilOp
+ /* OpenGL Test function */
+ assignGlobalInt( GL_NEVER, "GL_NEVER" ); // Always fails
+ assignGlobalInt( GL_LESS, "GL_LESS" ); // Passes if ( ref & mask ) < ( stencil & mask )
+ assignGlobalInt( GL_LEQUAL, "GL_LEQUAL" ); // Passes if ( ref & mask ) <= ( stencil & mask )
+ assignGlobalInt( GL_GREATER, "GL_GREATER" ); // Passes if ( ref & mask ) > ( stencil & mask )
+ assignGlobalInt( GL_GEQUAL, "GL_GEQUAL" ); // Passes if ( ref & mask ) >= ( stencil & mask )
+ assignGlobalInt( GL_EQUAL, "GL_EQUAL" ); // Passes if ( ref & mask ) = ( stencil & mask )
+ assignGlobalInt( GL_NOTEQUAL, "GL_NOTEQUAL" ); // Passes if ( ref & mask ) != ( stencil & mask )
+ assignGlobalInt( GL_ALWAYS, "GL_ALWAYS" ); // Always passes
+ /* OpenGL Face */
+ assignGlobalInt( GL_FRONT, "GL_FRONT" );
+ assignGlobalInt( GL_BACK, "GL_BACK" );
+ assignGlobalInt( GL_FRONT_AND_BACK, "GL_FRONT_AND_BACK" );
+ /* OpenGL Stencil test */
+ assignGlobalInt( GL_KEEP, "GL_KEEP" ); // Keeps the current value
+ assignGlobalInt( GL_ZERO, "GL_ZERO" ); // Sets the stencil buffer value to 0
+ assignGlobalInt( GL_REPLACE, "GL_REPLACE" ); // Sets the stencil buffer value to ref, as specified by glStencilFunc
+ assignGlobalInt( GL_INCR, "GL_INCR" ); // Increments the current stencil buffer value. Clamps to the maximum representable unsigned value
+ assignGlobalInt( GL_INCR_WRAP, "GL_INCR_WRAP" ); // Increments the current stencil buffer value. Wraps stencil buffer value to zero when incrementing the maximum representable unsigned value
+ assignGlobalInt( GL_DECR, "GL_DECR" ); // Decrements the current stencil buffer value. Clamps to 0
+ assignGlobalInt( GL_DECR_WRAP, "GL_DECR_WRAP" ); // Decrements the current stencil buffer value. Wraps stencil buffer value to the maximum representable unsigned value when decrementing a stencil buffer value of zero
+ assignGlobalInt( GL_INVERT, "GL_INVERT" ); // Bitwise inverts the current stencil buffer value
+ /* OpenGL Connection */
+ assignGlobalInt( GL_VENDOR, "GL_VENDOR" ); // Returns the company responsible for this GL implementation. This name does not change from release to release
+ assignGlobalInt( GL_RENDERER, "GL_RENDERER" ); // Returns the name of the renderer. This name is typically specific to a particular configuration of a hardware platform. It does not change from release to release
+ assignGlobalInt( GL_VERSION, "GL_VERSION" ); // Returns a version or release number of the form OpenGLES
+ assignGlobalInt( GL_SHADING_LANGUAGE_VERSION, "GL_SHADING_LANGUAGE_VERSION" ); // Returns a version or release number for the shading language of the form OpenGLESGLSLES
+ assignGlobalInt( GL_EXTENSIONS, "GL_EXTENSIONS" ); // Returns a space-separated list of supported extensions to GL
+ /* CBuffer Data type */
assignGlobalInt( BUFFER_UNSIGNED_CHAR, "BUFFER_UNSIGNED_CHAR" ); // C type unsigned char
assignGlobalInt( BUFFER_UNSIGNED_SHORT, "BUFFER_UNSIGNED_SHORT" ); // C type unsigned short
assignGlobalInt( BUFFER_UNSIGNED_INT, "BUFFER_UNSIGNED_INT" ); // C type unsigned int
@@ -2259,8 +2298,19 @@ void luaRegister() {
assingGlobalFunction( "rlSetMatrixViewOffsetStereo", lrlglSetMatrixViewOffsetStereo );
/* OpenGL */
- /* Framebuffer management. */
+ /* Frame Buffers. */
assingGlobalFunction( "glBlitFramebuffer", lglBlitFramebuffer );
+ /* State Management. */
+ assingGlobalFunction( "glEnable", lglEnable );
+ assingGlobalFunction( "glDisable", lglDisable );
+ assingGlobalFunction( "glStencilFunc", lglStencilFunc );
+ assingGlobalFunction( "glStencilFuncSeparate", lglStencilFuncSeparate );
+ assingGlobalFunction( "glStencilMask", lglStencilMask );
+ assingGlobalFunction( "glStencilMaskSeparate", lglStencilMaskSeparate );
+ assingGlobalFunction( "glStencilOp", lglStencilOp );
+ assingGlobalFunction( "glStencilOpSeparate", lglStencilOpSeparate );
+ /* Utility. */
+ assingGlobalFunction( "glGetString", lglGetString );
/* Easings */
/* Linear Easing functions. */
@@ -3301,3 +3351,8 @@ int uluaGetTableLen( lua_State* L, int index ) {
}
return i;
}
+
+/* Accepts no arg and nil. */
+bool uluaIsNil( lua_State* L, int index ) {
+ return lua_type( L, index ) <= 0; /* -1 is no arg(nil) and 0 is nil. */
+}