Getting rid of setlinestyle: sample line in Image space.

This commit is contained in:
2017-04-29 20:41:57 +02:00
parent 74f9d31409
commit c4491d76ed

View File

@@ -686,23 +686,27 @@ 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);
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);
immBegin(PRIM_LINES, 2);
immUniformColor3ub(0, 0, 0);
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(1);
immBegin(PRIM_LINES, 2);
immUniformColor3ub(255, 255, 255);
immVertex2fv(pos, hist->co[0]);
immVertex2fv(pos, hist->co[1]);
immEnd();
setlinestyle(0);
immUnbindProgram();
}
}