Add imm_draw_checker_box function
This replaces `fdrawcheckerboard` in drawing a standard gray checkerboard for alpha backgrounds.
This commit is contained in:
@@ -128,6 +128,9 @@ void imm_draw_line_box(unsigned pos, float x1, float y1, float x2, float y2);
|
||||
/* use this version when VertexFormat has a vec3 position */
|
||||
void imm_draw_line_box_3D(unsigned pos, float x1, float y1, float x2, float y2);
|
||||
|
||||
/* Draw a standard checkerboard to indicate transparent backgrounds */
|
||||
void imm_draw_checker_box(float x1, float y1, float x2, float y2);
|
||||
|
||||
void imm_draw_line(unsigned pos, float x1, float y1, float x2, float y2);
|
||||
/**
|
||||
* Pack color into 3 bytes
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user