Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2016-11-15 20:16:47 +0300
committerMike Erwin <significant.bit@gmail.com>2016-11-15 20:19:47 +0300
commit2653758adcb241dfc7934f1af45f2f0700478a80 (patch)
tree934eb5ebdc076200632833a6dd43a4a14168b60c /source/blender/editors/animation/anim_draw.c
parentb78ddd43a5af7810b9befb1cdf2be0528c721932 (diff)
blender 2.8: OpenGL immediate mode: anim_draw
Reviewers: merwin Reviewed By: merwin Maniphest Tasks: T49043 Differential Revision: https://developer.blender.org/D2353
Diffstat (limited to 'source/blender/editors/animation/anim_draw.c')
-rw-r--r--source/blender/editors/animation/anim_draw.c52
1 files changed, 37 insertions, 15 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 33e44d73894..58b9b8eba91 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -62,6 +62,8 @@
#include "UI_resources.h"
#include "UI_view2d.h"
+#include "GPU_immediate.h"
+
/* *************************************************** */
/* CURRENT FRAME DRAWING */
@@ -95,9 +97,16 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const
x = cfra * xscale;
y = 0.9f * U.widget_unit;
+ VertexFormat *format = immVertexFormat();
+ unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
+
+ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+
/* draw green box around/behind text */
- UI_ThemeColorShade(TH_CFRAME, 0);
- glRectf(x, y, x + slen, y + 0.75f * U.widget_unit);
+ immUniformThemeColorShade(TH_CFRAME, 0);
+
+ immRectf(pos, x, y, x + slen, y + 0.75f * U.widget_unit);
+ immUnbindProgram();
/* draw current frame number - black text */
UI_ThemeColor(TH_TEXT);
@@ -112,17 +121,23 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
{
Scene *scene = CTX_data_scene(C);
- /* Draw a light green line to indicate current frame */
- UI_ThemeColor(TH_CFRAME);
-
const float x = (float)(scene->r.cfra * scene->r.framelen);
glLineWidth((flag & DRAWCFRA_WIDE) ? 3.0 : 2.0);
- glBegin(GL_LINES);
- glVertex2f(x, v2d->cur.ymin - 500.0f); /* XXX arbitrary... want it go to bottom */
- glVertex2f(x, v2d->cur.ymax);
- glEnd();
+ VertexFormat *format = immVertexFormat();
+ unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
+
+ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+
+ /* Draw a light green line to indicate current frame */
+ immUniformThemeColor(TH_CFRAME);
+
+ immBegin(GL_LINES, 2);
+ immVertex2f(pos, x, v2d->cur.ymin - 500.0f); /* XXX arbitrary... want it go to bottom */
+ immVertex2f(pos, x, v2d->cur.ymax);
+ immEnd();
+ immUnbindProgram();
/* Draw current frame number in a little box */
if (flag & DRAWCFRA_SHOW_NUMBOX) {
@@ -144,17 +159,24 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width)
if (PRVRANGEON) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
- glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
-
+
+ VertexFormat *format = immVertexFormat();
+ unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
+
+ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+ immUniformColor4f(0.0f, 0.0f, 0.0f, 0.4f);
+
/* only draw two separate 'curtains' if there's no overlap between them */
if (PSFRA < PEFRA + end_frame_width) {
- glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax);
- glRectf((float)(PEFRA + end_frame_width), v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
+ immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)PSFRA, v2d->cur.ymax);
+ immRectf(pos, (float)(PEFRA + end_frame_width), v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
}
else {
- glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
+ immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
}
-
+
+ immUnbindProgram();
+
glDisable(GL_BLEND);
}
}