diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2017-03-16 16:15:01 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2017-03-16 16:15:01 +0300 |
commit | dd3ae7bad70ecfd466791f371b138b5b958e0a19 (patch) | |
tree | a4878f73211d4162ee79ff0e4fda986634f269dc /source/blender/editors/space_image | |
parent | dd7b60c638603e13b62891df4a768d904f742003 (diff) |
OpenGL immediate mode: `image_draw.c`: Draw `Sample Line` with new imm mode
part of T49043
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index fc872c9ada6..da1f2ad9741 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -689,20 +689,25 @@ void draw_image_sample_line(SpaceImage *sima) if (sima->sample_line_hist.flag & HISTO_FLAG_SAMPLELINE) { Histogram *hist = &sima->sample_line_hist; - glBegin(GL_LINES); - glColor3ub(0, 0, 0); - glVertex2fv(hist->co[0]); - glVertex2fv(hist->co[1]); - glEnd(); + unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + + immBegin(GL_LINES, 2); + immUniformColor3ub(0, 0, 0); + immVertex2fv(pos, hist->co[0]); + immVertex2fv(pos, hist->co[1]); + immEnd(); setlinestyle(1); - glBegin(GL_LINES); - glColor3ub(255, 255, 255); - glVertex2fv(hist->co[0]); - glVertex2fv(hist->co[1]); - glEnd(); + immBegin(GL_LINES, 2); + immUniformColor3ub(255, 255, 255); + immVertex2fv(pos, hist->co[0]); + immVertex2fv(pos, hist->co[1]); + immEnd(); setlinestyle(0); + immUnbindProgram(); + } } |