diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2017-04-29 21:41:57 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2017-04-29 21:41:57 +0300 |
commit | c4491d76ed35c1cdc02f2a74539bd14d7fde43dd (patch) | |
tree | a07e12fae2f85e698ebd45488dfef173c7162042 /source/blender/editors | |
parent | 74f9d3140934c5dea01821caaba9a0527579ef2a (diff) |
Getting rid of setlinestyle: sample line in Image space.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index cdd9906271c..7c888860375 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -686,22 +686,26 @@ void draw_image_sample_line(SpaceImage *sima) if (sima->sample_line_hist.flag & HISTO_FLAG_SAMPLELINE) { Histogram *hist = &sima->sample_line_hist; - unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + VertexFormat *format = immVertexFormat(); + unsigned int shdr_dashed_pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT); + unsigned int shdr_dashed_origin = VertexFormat_add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT); - immBegin(PRIM_LINES, 2); - immUniformColor3ub(0, 0, 0); - immVertex2fv(pos, hist->co[0]); - immVertex2fv(pos, hist->co[1]); - immEnd(); + immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); + + float viewport_size[4]; + glGetFloatv(GL_VIEWPORT, viewport_size); + immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); + + immUniform4f("color1", 1.0f, 1.0f, 1.0f, 1.0f); + immUniform4f("color2", 0.0f, 0.0f, 0.0f, 1.0f); + immUniform1f("dash_width", 2.0f); + immUniform1f("dash_width_on", 1.0f); - setlinestyle(1); immBegin(PRIM_LINES, 2); - immUniformColor3ub(255, 255, 255); - immVertex2fv(pos, hist->co[0]); - immVertex2fv(pos, hist->co[1]); + immAttrib2fv(shdr_dashed_origin, hist->co[0]); + immVertex2fv(shdr_dashed_pos, hist->co[0]); + immVertex2fv(shdr_dashed_pos, hist->co[1]); immEnd(); - setlinestyle(0); immUnbindProgram(); } |