diff options
author | Alexander Romanov <a.romanov@blend4web.com> | 2016-04-08 10:58:40 +0300 |
---|---|---|
committer | Alexander Romanov <a.romanov@blend4web.com> | 2016-04-08 10:58:40 +0300 |
commit | d969192fbe6129021f0399cc35c6c2be6aa72eda (patch) | |
tree | 741562b7728eee95105425d260ef150236c8c97c /source/blender/gpu/GPU_basic_shader.h | |
parent | a51e9ece538fb00c939ccaca7d6fbb1fe491bf10 (diff) |
Wide lines + line stipple deprecated API replacement
The patch contains an implementation of the wide lines and the line stipple that is necessary for OpenGL upgrade.
For the implementation I have chosen the geometry shader because it required minimum changes for the wrapper calls and such implementation is the best for the "basic shader" architecture.
There are few shortcomings that can be corrected in future. They all are related to the fact that the lines in one strip are not connected with each other. So the stipple pattern is not continuous on the common vertex of two lines. There is also no continuity of form (each line is an independent rectangular).
But the advantage is that even outdated glBegin, glVertex work! Though with the above restrictions.
Continuity of form and stipple can be implemented with additional attributes, and it will require more changes in calls.
At the moment, the patch replaces calls for some "gestures". It works satisfactorily for "cross" or "rectangular" and not so good for "lasso" and "circle" due to the above-mentioned shortcomings.
Don't forget to set USE_GLSL to true for testing.
Alexander Romanov (Blend4Web Team)
Reviewers: merwin, brecht
Reviewed By: merwin, brecht
Subscribers: aligorith, Evgeny_Rodygin, AlexKowel, yurikovelenov
Differential Revision: https://developer.blender.org/D1880
Diffstat (limited to 'source/blender/gpu/GPU_basic_shader.h')
-rw-r--r-- | source/blender/gpu/GPU_basic_shader.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/gpu/GPU_basic_shader.h b/source/blender/gpu/GPU_basic_shader.h index f376850a8f9..df2da971845 100644 --- a/source/blender/gpu/GPU_basic_shader.h +++ b/source/blender/gpu/GPU_basic_shader.h @@ -33,6 +33,7 @@ #define __GPU_BASIC_SHADER_H__ #include "BLI_utildefines.h" +#include "GPU_glew.h" #ifdef __cplusplus extern "C" { @@ -48,7 +49,8 @@ typedef enum GPUBasicShaderOption { GPU_SHADER_SOLID_LIGHTING = (1 << 4), /* use faster lighting (set automatically) */ GPU_SHADER_STIPPLE = (1 << 5), /* use stipple */ - GPU_SHADER_OPTIONS_NUM = 6, + GPU_SHADER_LINE = (1 << 6), /* draw lines */ + GPU_SHADER_OPTIONS_NUM = 7, GPU_SHADER_OPTION_COMBINATIONS = (1 << GPU_SHADER_OPTIONS_NUM) } GPUBasicShaderOption; @@ -105,6 +107,8 @@ typedef struct GPULightData { void GPU_basic_shader_light_set(int light_num, GPULightData *light); void GPU_basic_shader_light_set_viewer(bool local); void GPU_basic_shader_stipple(GPUBasicShaderStipple stipple_id); +void GPU_basic_shader_line_stipple(GLint stipple_factor, GLushort stipple_pattern); +void GPU_basic_shader_line_width(float line_width); #ifdef __cplusplus } |