From 342d4faf14fd428d7797285b3727f0e440879cf3 Mon Sep 17 00:00:00 2001 From: Jeffery Myers Date: Sun, 13 Dec 2020 01:58:24 -0800 Subject: [PATCH] Add options to set line width and aliasing to rlGL layer. (#1457) * Add options to set line width and aliasing to rlGL layer. * Don't do line smoothing in OpenGLES --- src/rlgl.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/rlgl.h b/src/rlgl.h index 5985c8254..f5634a547 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -522,6 +522,10 @@ RLAPI void rlDisableScissorTest(void); // Disable scissor RLAPI void rlScissor(int x, int y, int width, int height); // Scissor test RLAPI void rlEnableWireMode(void); // Enable wire mode RLAPI void rlDisableWireMode(void); // Disable wire mode +RLAPI void rlSetLineWidth(float width); // Set the line drawing width +RLAPI float rlGetLineWidth(void); // Get the line drawing width +RLAPI void rlEnableSmoothLines(void); // Enable line aliasing +RLAPI void rlDisableSmoothLines(void); // Disable line aliasing 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) @@ -1479,6 +1483,35 @@ void rlDisableWireMode(void) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); #endif } +// Set the line drawing width +void rlSetLineWidth(float width) +{ + glLineWidth(width); +} + +// Get the line drawing width +float rlGetLineWidth(void) +{ + float width = 0; + glGetFloatv(GL_LINE_WIDTH, &width); + return width; +} + +// Enable line aliasing +void rlEnableSmoothLines(void) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_21) || defined(GRAPHICS_API_OPENGL_11) + glEnable(GL_LINE_SMOOTH); +#endif +} + +// Disable line aliasing +void rlDisableSmoothLines(void) +{ +#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_21) || defined(GRAPHICS_API_OPENGL_11) + glDisable(GL_LINE_SMOOTH); +#endif +} // Unload framebuffer from GPU memory // NOTE: All attached textures/cubemaps/renderbuffers are also deleted