[Bf-blender-cvs] [9151f12dad] blender2.8: Immediate Mode: animation markers
Dalai Felinto
noreply at git.blender.org
Tue Feb 14 11:10:55 CET 2017
Commit: 9151f12dadd45a015da14ddc30d0d7b5c0200162
Author: Dalai Felinto
Date: Tue Feb 14 11:10:51 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB9151f12dadd45a015da14ddc30d0d7b5c0200162
Immediate Mode: animation markers
===================================================================
M source/blender/editors/animation/anim_markers.c
===================================================================
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index ef9c2ced58..cc5957003b 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 */
More information about the Bf-blender-cvs
mailing list