[Bf-blender-cvs] [c4491d76ed3] blender2.8: Getting rid of setlinestyle: sample line in Image space.
Bastien Montagne
noreply at git.blender.org
Sat Apr 29 20:42:38 CEST 2017
Commit: c4491d76ed35c1cdc02f2a74539bd14d7fde43dd
Author: Bastien Montagne
Date: Sat Apr 29 20:41:57 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBc4491d76ed35c1cdc02f2a74539bd14d7fde43dd
Getting rid of setlinestyle: sample line in Image space.
===================================================================
M source/blender/editors/space_image/image_draw.c
===================================================================
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();
}
More information about the Bf-blender-cvs
mailing list