MCPcopy Create free account
hub / github.com/OpenImageDebugger/OpenImageDebugger / initialize

Method initialize

src/visualization/components/buffer.cpp:578–607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

576}
577
578bool Buffer::initialize() {
579 if (!create_shader_program()) {
580 return false;
581 }
582
583 // Buffer VBO
584 // clang-format off
585 static constexpr auto g_vertex_buffer_data = std::array{
586 -0.5f, -0.5f,
587 0.5f, -0.5f,
588 0.5f, 0.5f,
589 0.5f, 0.5f,
590 -0.5f, 0.5f,
591 -0.5f, -0.5f,
592 };
593 // clang-format on
594
595 gl_canvas_ref().glGenBuffers(1, &vbo_);
596 gl_canvas_ref().glBindBuffer(GL_ARRAY_BUFFER, vbo_);
597 gl_canvas_ref().glBufferData(GL_ARRAY_BUFFER,
598 sizeof(g_vertex_buffer_data),
599 g_vertex_buffer_data.data(),
600 GL_STATIC_DRAW);
601
602 setup_gl_buffer();
603
604 update_object_pose();
605
606 return true;
607}
608
609void Buffer::draw(const mat4& projection, const mat4& viewInv) {
610 buff_prog_.use();

Callers

nothing calls this directly

Calls 4

glGenBuffersMethod · 0.80
glBindBufferMethod · 0.80
glBufferDataMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected