MCPcopy Create free account
hub / github.com/Illation/ETEngine / Initialize

Method Initialize

Engine/source/EtRendering/Extensions/DebugRenderer.cpp:24–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24void DebugRenderer::Initialize()
25{
26 I_GraphicsApiContext* const api = Viewport::GetCurrentApiContext();
27
28 m_pShader = core::ResourceManager::Instance()->GetAssetData<ShaderData>(core::HashString("DebugRenderer.glsl"));
29
30 api->SetShader(m_pShader.get());
31
32 //Generate buffers and arrays
33 m_VAO = api->CreateVertexArray();
34 m_VBO = api->CreateBuffer();
35
36 //bind
37 api->BindVertexArray(m_VAO);
38 api->BindBuffer(E_BufferType::Vertex, m_VBO);
39
40 //set data and attributes
41 api->SetBufferData(E_BufferType::Vertex, m_BufferSize, nullptr, E_UsageHint::Dynamic);
42
43 //input layout
44 api->SetVertexAttributeArrayEnabled(0, true);
45 api->SetVertexAttributeArrayEnabled(1, true);
46
47 api->DefineVertexAttributePointer(0, 3, E_DataType::Float, false, sizeof(LineVertex), offsetof(LineVertex, pos));
48 api->DefineVertexAttributePointer(1, 4, E_DataType::Float, false, sizeof(LineVertex), offsetof(LineVertex, col));
49
50 //unbind
51 api->BindBuffer(E_BufferType::Vertex, 0);
52 api->BindVertexArray(0);
53}
54
55void DebugRenderer::UpdateBuffer()
56{

Callers

nothing calls this directly

Calls 9

HashStringClass · 0.85
SetShaderMethod · 0.80
CreateVertexArrayMethod · 0.80
CreateBufferMethod · 0.80
BindVertexArrayMethod · 0.80
BindBufferMethod · 0.80
SetBufferDataMethod · 0.80

Tested by

no test coverage detected