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
This commit is contained in:
Jeffery Myers 2020-12-13 01:58:24 -08:00 committed by GitHub
parent e6ae4879f6
commit 342d4faf14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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