blender 2.8: OpenGL immediate mode: node_draw_preview_background

all is in the title.

Reviewers: merwin

Tags: #bf_blender_2.8, #opengl_gfx

Maniphest Tasks: T49043

Differential Revision: https://developer.blender.org/D2336
This commit is contained in:
Mike Erwin
2016-11-08 11:10:47 -05:00
parent 12bce04b2f
commit 2b726b054e

View File

@@ -638,10 +638,15 @@ static void node_draw_preview_background(float tile, rctf *rect)
{
float x, y;
VertexFormat *format = immVertexFormat();
unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* draw checkerboard backdrop to show alpha */
glColor3ub(120, 120, 120);
glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
glColor3ub(160, 160, 160);
immUniformColor3ub(120, 120, 120);
immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
immUniformColor3ub(160, 160, 160);
for (y = rect->ymin; y < rect->ymax; y += tile * 2) {
for (x = rect->xmin; x < rect->xmax; x += tile * 2) {
@@ -652,7 +657,7 @@ static void node_draw_preview_background(float tile, rctf *rect)
if (y + tile > rect->ymax)
tiley = rect->ymax - y;
glRectf(x, y, x + tilex, y + tiley);
immRectf(pos, x, y, x + tilex, y + tiley);
}
}
for (y = rect->ymin + tile; y < rect->ymax; y += tile * 2) {
@@ -664,9 +669,10 @@ static void node_draw_preview_background(float tile, rctf *rect)
if (y + tile > rect->ymax)
tiley = rect->ymax - y;
glRectf(x, y, x + tilex, y + tiley);
immRectf(pos, x, y, x + tilex, y + tiley);
}
}
immUnbindProgram();
}
/* not a callback */