diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-02-14 13:10:51 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-02-14 13:10:51 +0300 |
commit | 9151f12dadd45a015da14ddc30d0d7b5c0200162 (patch) | |
tree | 9d8ab35479ec8fa78c4523a9072e8f18f252d2b6 /source/blender/editors/animation | |
parent | 10892944399ebca856163cc8c805c0de3c598614 (diff) |
Immediate Mode: animation markers
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_markers.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index ef9c2ced580..cc5957003b6 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -59,6 +59,8 @@ #include "BIF_gl.h" #include "BIF_glutil.h" +#include "GPU_immediate.h" + #include "UI_interface.h" #include "UI_interface_icons.h" #include "UI_view2d.h" @@ -348,19 +350,24 @@ static void draw_marker( if (flag & DRAW_MARKERS_LINES) #endif { + unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); setlinestyle(3); - if (marker->flag & SELECT) - glColor4ub(255, 255, 255, 96); - else - glColor4ub(0, 0, 0, 96); - - glBegin(GL_LINES); - glVertex2f(xpos + 0.5f, 12.0f); - glVertex2f(xpos + 0.5f, (v2d->cur.ymax + 12.0f) * yscale); - glEnd(); - + if (marker->flag & SELECT) { + immUniformColor4ub(255, 255, 255, 96); + } + else { + immUniformColor4ub(0, 0, 0, 96); + } + + immBegin(GL_LINES, 2); + immVertex2f(pos, xpos + 0.5f, 12.0f); + immVertex2f(pos, xpos + 0.5f, (v2d->cur.ymax + 12.0f) * yscale); + immEnd(); setlinestyle(0); + + immUnbindProgram(); } /* 5 px to offset icon to align properly, space / pixels corrects for zoom */ @@ -438,15 +445,20 @@ void ED_markers_draw(const bContext *C, int flag) v2d = UI_view2d_fromcontext(C); if (flag & DRAW_MARKERS_MARGIN) { + unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + const unsigned char shade[4] = {0, 0, 0, 16}; - glColor4ubv(shade); + immUniformColor4ubv(shade); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glRectf(v2d->cur.xmin, 0, v2d->cur.xmax, UI_MARKER_MARGIN_Y); + immRectf(pos, v2d->cur.xmin, 0, v2d->cur.xmax, UI_MARKER_MARGIN_Y); glDisable(GL_BLEND); + + immUnbindProgram(); } /* no time correction for framelen! space is drawn with old values */ |