added rounded rectangle, first iteration works but still needs improved corners

This commit is contained in:
Omar Mohamed Ali Mudhir
2017-01-16 03:58:21 +00:00
parent baaaf213cc
commit 8c217af051
4 changed files with 131 additions and 45 deletions

View File

@@ -50,3 +50,18 @@ public:
return create_buffers(idx, vertices, sizeof(idx), sizeof(vertices));
}
};
class Rounded : public Shape
{
void create_impl(float w, float h, float r, int div, GLushort* idx, GLushort* idx_tmp, vertex_t* vertices);
public:
template<int div>
bool create(float w, float h, float r)
{
static GLushort idx[(10 + div * 4) * 3];
static GLushort idx_tmp[div+1];
static vertex_t vertices[12 + (div-1) * 4];
create_impl(w, h, r, div, idx, idx_tmp, vertices);
return create_buffers(idx, vertices, sizeof(idx), sizeof(vertices));
}
};