use new enum types in glutil & imm_util

This commit is contained in:
Mike Erwin 2016-11-17 16:10:53 -05:00
parent d915e89ec8
commit fe73b8c29c
2 changed files with 9 additions and 9 deletions

View File

@ -171,7 +171,7 @@ void glutil_draw_lined_arc(float start, float angle, float radius, int nsegments
glEnd();
}
static void imm_draw_circle(GLenum prim_type, unsigned pos, float x, float y, float rad, int nsegments)
static void imm_draw_circle(PrimitiveType prim_type, unsigned pos, float x, float y, float rad, int nsegments)
{
immBegin(prim_type, nsegments);
for (int i = 0; i < nsegments; ++i) {
@ -184,17 +184,17 @@ static void imm_draw_circle(GLenum prim_type, unsigned pos, float x, float y, fl
void imm_draw_lined_circle(unsigned pos, float x, float y, float rad, int nsegments)
{
imm_draw_circle(GL_LINE_LOOP, pos, x, y, rad, nsegments);
imm_draw_circle(PRIM_LINE_LOOP, pos, x, y, rad, nsegments);
}
void imm_draw_filled_circle(unsigned pos, float x, float y, float rad, int nsegments)
{
imm_draw_circle(GL_TRIANGLE_FAN, pos, x, y, rad, nsegments);
imm_draw_circle(PRIM_TRIANGLE_FAN, pos, x, y, rad, nsegments);
}
void imm_draw_lined_circle_3D(unsigned pos, float x, float y, float rad, int nsegments)
{
immBegin(GL_LINE_LOOP, nsegments);
immBegin(PRIM_LINE_LOOP, nsegments);
for (int i = 0; i < nsegments; ++i) {
float angle = 2 * M_PI * ((float)i / (float)nsegments);
immVertex3f(pos, x + rad * cosf(angle),
@ -205,7 +205,7 @@ void imm_draw_lined_circle_3D(unsigned pos, float x, float y, float rad, int nse
void imm_draw_line_box(unsigned pos, float x1, float y1, float x2, float y2)
{
immBegin(GL_LINE_LOOP, 4);
immBegin(PRIM_LINE_LOOP, 4);
immVertex2f(pos, x1, y1);
immVertex2f(pos, x1, y2);
immVertex2f(pos, x2, y2);
@ -216,7 +216,7 @@ void imm_draw_line_box(unsigned pos, float x1, float y1, float x2, float y2)
void imm_draw_line_box_3D(unsigned pos, float x1, float y1, float x2, float y2)
{
/* use this version when VertexFormat has a vec3 position */
immBegin(GL_LINE_LOOP, 4);
immBegin(PRIM_LINE_LOOP, 4);
immVertex3f(pos, x1, y1, 0.0f);
immVertex3f(pos, x1, y2, 0.0f);
immVertex3f(pos, x2, y2, 0.0f);

View File

@ -15,7 +15,7 @@
void immRectf(unsigned pos, float x1, float y1, float x2, float y2)
{
immBegin(GL_TRIANGLE_FAN, 4);
immBegin(PRIM_TRIANGLE_FAN, 4);
immVertex2f(pos, x1, y1);
immVertex2f(pos, x2, y1);
immVertex2f(pos, x2, y2);
@ -25,7 +25,7 @@ void immRectf(unsigned pos, float x1, float y1, float x2, float y2)
void immRecti(unsigned pos, int x1, int y1, int x2, int y2)
{
immBegin(GL_TRIANGLE_FAN, 4);
immBegin(PRIM_TRIANGLE_FAN, 4);
immVertex2i(pos, x1, y1);
immVertex2i(pos, x2, y1);
immVertex2i(pos, x2, y2);
@ -37,7 +37,7 @@ void immRecti(unsigned pos, int x1, int y1, int x2, int y2)
void immRecti_complete(int x1, int y1, int x2, int y2, const float color[4])
{
VertexFormat *format = immVertexFormat();
unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT);
unsigned pos = add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4fv(color);
immRecti(pos, x1, y1, x2, y2);