fix attribute location (#20064)

This commit is contained in:
coulsonwang 2019-08-29 18:15:03 +08:00 committed by minggo
parent 6d8b1f5b9d
commit 66c4892b22
1 changed files with 10 additions and 2 deletions

View File

@ -41,8 +41,16 @@ NavMeshDebugDraw::NavMeshDebugDraw()
_locMVP = _programState->getUniformLocation("u_MVPMatrix");
auto vertexLayout = _programState->getVertexLayout();
vertexLayout->setAttribute("a_position", 0, backend::VertexFormat::FLOAT3, offsetof(V3F_C4F, position), false);
vertexLayout->setAttribute("a_color", 1, backend::VertexFormat::FLOAT4, offsetof(V3F_C4F, color), false);
vertexLayout->setAttribute("a_position",
_programState->getAttributeLocation("a_position"),
backend::VertexFormat::FLOAT3,
offsetof(V3F_C4F, position),
false);
vertexLayout->setAttribute("a_color",
_programState->getAttributeLocation("a_color"),
backend::VertexFormat::FLOAT4,
offsetof(V3F_C4F, color),
false);
vertexLayout->setLayout(sizeof(V3F_C4F));
_beforeCommand.func = CC_CALLBACK_0(NavMeshDebugDraw::onBeforeVisitCmd, this);