diff options
author | Luca Rood <dev@lucarood.com> | 2017-02-16 23:22:28 +0300 |
---|---|---|
committer | Luca Rood <dev@lucarood.com> | 2017-02-16 23:48:19 +0300 |
commit | b5cae50376ba32694a48e23dabf5d35c8e6d5d8b (patch) | |
tree | 137e4b6750efe6b0d72974d6789a7c265480cb07 /source/blender/editors/screen/glutil.c | |
parent | e3dd2b1591fdde19d533657303c8b10eb413fddb (diff) |
Add imm_draw_checker_box function
This replaces `fdrawcheckerboard` in drawing a standard gray
checkerboard for alpha backgrounds.
Diffstat (limited to 'source/blender/editors/screen/glutil.c')
-rw-r--r-- | source/blender/editors/screen/glutil.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 4baf3cd78b7..7f8454ac498 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -75,8 +75,9 @@ void fdrawbox(float x1, float y1, float x2, float y2) glEnd(); } -void fdrawcheckerboard(float x1, float y1, float x2, float y2) /* DEPRECATED */ +void fdrawcheckerboard(float x1, float y1, float x2, float y2) { + /* DEPRECATED: use imm_draw_checker_box instead */ unsigned char col1[4] = {40, 40, 40}, col2[4] = {50, 50, 50}; glColor3ubv(col1); @@ -232,6 +233,20 @@ void imm_draw_line_box_3D(unsigned pos, float x1, float y1, float x2, float y2) immEnd(); } +void imm_draw_checker_box(float x1, float y1, float x2, float y2) +{ + unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_CHECKER); + + immUniform4f("color1", 0.15f, 0.15f, 0.15f, 1.0f); + immUniform4f("color2", 0.2f, 0.2f, 0.2f, 1.0f); + immUniform1i("size", 8); + + immRectf(pos, x1, y1, x2, y2); + + immUnbindProgram(); +} + void imm_cpack(unsigned int x) { immUniformColor3ub(((x)& 0xFF), |