Skip to content

[rlgl] Add support for glPolygonOffset() #4580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions src/rlgl.h
Original file line number Diff line number Diff line change
@@ -691,6 +691,13 @@ RLAPI void rlDisableSmoothLines(void); // Disable line aliasing
RLAPI void rlEnableStereoRender(void); // Enable stereo rendering
RLAPI void rlDisableStereoRender(void); // Disable stereo rendering
RLAPI bool rlIsStereoRenderEnabled(void); // Check if stereo render is enabled
RLAPI void rlEnablePolygonOffsetFill(void); // Enable depth offset for faces
RLAPI void rlDisablePolygonOffsetFill(void); // Disable depth offset for faces
RLAPI void rlEnablePolygonOffsetLine(void); // Enable depth offset for lines
RLAPI void rlDisablePolygonOffsetLine(void); // Disable depth offset for lines
RLAPI void rlEnablePolygonOffsetPoint(void); // Enable depth offset for points
RLAPI void rlDisablePolygonOffsetPoint(void); // Disable depth offset for points
RLAPI void rlSetPolygonOffset(float factor, float units);// Set polygon depth offset

RLAPI void rlClearColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a); // Clear color buffer with color
RLAPI void rlClearScreenBuffers(void); // Clear used screen buffers (color and depth)
@@ -2048,6 +2055,47 @@ bool rlIsStereoRenderEnabled(void)
#endif
}

// Enable depth offset for faces
void rlEnablePolygonOffsetFill(void) { glEnable(GL_POLYGON_OFFSET_FILL); }

// Disable depth offset for faces
void rlDisablePolygonOffsetFill(void) { glDisable(GL_POLYGON_OFFSET_FILL); }

// Enable depth offset for lines
void rlEnablePolygonOffsetLine(void)
{
#if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33)
glEnable(GL_POLYGON_OFFSET_LINE);
#endif
}

// Disable depth offset for lines
void rlDisablePolygonOffsetLine(void)
{
#if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33)
glDisable(GL_POLYGON_OFFSET_LINE);
#endif
}

// Enable depth offset for points
void rlEnablePolygonOffsetPoint(void)
{
#if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33)
glEnable(GL_POLYGON_OFFSET_POINT);
#endif
}

// Disable depth offset for points
void rlDisablePolygonOffsetPoint(void)
{
#if defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_33)
glDisable(GL_POLYGON_OFFSET_POINT);
#endif
}

// Set polygon depth offset
void rlSetPolygonOffset(float factor, float units) { glPolygonOffset(factor, units); }

// Clear color buffer with color
void rlClearColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
{