26 const float_t radius = mobject_->radius();
27 _D(
"Create Circle: " << mobject_.mobject() <<
" with radius: " << radius
28 <<
" and depth: " << mobject_->pos().value().z());
32 std::vector<_gl GLfloat> vertices;
33 vertices.reserve((segments_ + 2) *
38 vertices.insert(vertices.end(), {0.0f, 0.0f, mobject_->pos().value().z()});
39 vertices.insert(vertices.end(),
40 {mobject_->stroke_color().r(), mobject_->stroke_color().g(),
41 mobject_->stroke_color().b()});
44 for (
int i = 0; i <= segments_; ++i) {
46 float_t x = radius * cos(angle);
47 float_t y = radius * sin(angle);
48 vertices.insert(vertices.end(), {x, y, mobject_->pos().value().z()});
49 vertices.insert(vertices.end(), {mobject_->stroke_color().r(),
50 mobject_->stroke_color().g(),
51 mobject_->stroke_color().b()});
54 vbo_.
buffer_data(vertices.data(), vertices.size() *
sizeof(
float),
57 _gl glEnableVertexAttribArray(0);
58 _gl glVertexAttribPointer(0, 3, _gl GL_FLOAT, _gl GL_FALSE,
60 (
void*)(0 *
sizeof(
float)));
63 _gl glEnableVertexAttribArray(1);
64 _gl glVertexAttribPointer(1, 3, _gl GL_FLOAT, _gl GL_FALSE,
66 (
void*)(3 *
sizeof(
float)));