Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-11-02 16:58:49 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-11-02 17:45:13 +0300
commit721a19d2b8a7784c48c753d57dfbf984524a54de (patch)
tree0be919eabfa00b65ad70a5bdea11d9676e31c9cb /source/blender/gpu/intern/gpu_state.c
parent00ef0a4d8efc783e93d2e524d3a9d59a0230704f (diff)
GPU: Add safety check for max line width
On some platform does not support line width > 1.0 and can even throw and error. Better check an at least display something rather than no lines at all.
Diffstat (limited to 'source/blender/gpu/intern/gpu_state.c')
-rw-r--r--source/blender/gpu/intern/gpu_state.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_state.c b/source/blender/gpu/intern/gpu_state.c
index 0f07b2debc3..afc8570356b 100644
--- a/source/blender/gpu/intern/gpu_state.c
+++ b/source/blender/gpu/intern/gpu_state.c
@@ -29,6 +29,7 @@
#include "GPU_glew.h"
#include "GPU_state.h"
+#include "GPU_extensions.h"
static GLenum gpu_get_gl_blendfunction(GPUBlendFunction blend)
{
@@ -118,7 +119,13 @@ void GPU_line_stipple(bool enable)
void GPU_line_width(float width)
{
- glLineWidth(width * U.pixelsize);
+ float max_size = GPU_max_line_width();
+ float final_size = width * U.pixelsize;
+ /* Fix opengl errors on certain platform / drivers. */
+ if (max_size < final_size) {
+ final_size = max_size;
+ }
+ glLineWidth(final_size);
}
void GPU_point_size(float size)