Browse Source

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
Jeffery Myers 4 years ago
parent
commit
342d4faf14
1 changed files with 33 additions and 0 deletions
  1. 33 0
      src/rlgl.h

+ 33 - 0
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