[Bf-blender-cvs] [dd3ae7bad7] blender2.8: OpenGL immediate mode: `image_draw.c`: Draw `Sample Line` with new imm mode
Germano Cavalcante
noreply at git.blender.org
Thu Mar 16 14:15:18 CET 2017
Commit: dd3ae7bad70ecfd466791f371b138b5b958e0a19
Author: Germano Cavalcante
Date: Thu Mar 16 10:15:01 2017 -0300
Branches: blender2.8
https://developer.blender.org/rBdd3ae7bad70ecfd466791f371b138b5b958e0a19
OpenGL immediate mode: `image_draw.c`: Draw `Sample Line` with new imm mode
part of T49043
===================================================================
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 fc872c9ada..da1f2ad974 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();
+
}
}
More information about the Bf-blender-cvs
mailing list