Skip to content

Commit 2761aa4

Browse files
authored
Added function rlCullFace (#2797)
rlCullFace sets the face culling mode to RL_FRONT or RL_BACK which correspond to GL_FRONT and GL_BACK respectively.
1 parent c8fd93d commit 2761aa4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/rlgl.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,12 @@ typedef enum {
498498
RL_ATTACHMENT_RENDERBUFFER = 200, // Framebuffer texture attachment type: renderbuffer
499499
} rlFramebufferAttachTextureType;
500500

501+
// Face culling mode
502+
typedef enum {
503+
RL_FRONT = 0,
504+
RL_BACK
505+
} rlCullMode;
506+
501507
//------------------------------------------------------------------------------------
502508
// Functions Declaration - Matrix operations
503509
//------------------------------------------------------------------------------------
@@ -578,6 +584,7 @@ RLAPI void rlEnableDepthMask(void); // Enable depth write
578584
RLAPI void rlDisableDepthMask(void); // Disable depth write
579585
RLAPI void rlEnableBackfaceCulling(void); // Enable backface culling
580586
RLAPI void rlDisableBackfaceCulling(void); // Disable backface culling
587+
RLAPI void rlCullFace(rlCullMode mode); // Set face culling mode
581588
RLAPI void rlEnableScissorTest(void); // Enable scissor test
582589
RLAPI void rlDisableScissorTest(void); // Disable scissor test
583590
RLAPI void rlScissor(int x, int y, int width, int height); // Scissor test
@@ -1671,6 +1678,18 @@ void rlEnableBackfaceCulling(void) { glEnable(GL_CULL_FACE); }
16711678
// Disable backface culling
16721679
void rlDisableBackfaceCulling(void) { glDisable(GL_CULL_FACE); }
16731680

1681+
// Set face culling mode
1682+
void rlCullFace(rlCullMode mode) {
1683+
switch (mode) {
1684+
case RL_BACK:
1685+
glCullFace(GL_BACK);
1686+
break;
1687+
case RL_FRONT:
1688+
glCullFace(GL_FRONT);
1689+
break;
1690+
}
1691+
}
1692+
16741693
// Enable scissor test
16751694
void rlEnableScissorTest(void) { glEnable(GL_SCISSOR_TEST); }
16761695

0 commit comments

Comments
 (0)