diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2016-07-15 17:51:04 +0300 |
---|---|---|
committer | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2016-07-15 18:16:47 +0300 |
commit | 8c6af601043c637d86a66bf134c3e2d99f70e4c1 (patch) | |
tree | c7e04526e23145219f15de24a3f6b6cf33a099b6 /drape_frontend | |
parent | b872098f3e5c30d18e15e97097d01b0e6fc83534 (diff) |
Fixed arrow rendering on simulator
Diffstat (limited to 'drape_frontend')
-rw-r--r-- | drape_frontend/arrow3d.cpp | 23 | ||||
-rw-r--r-- | drape_frontend/arrow3d.hpp | 2 |
2 files changed, 14 insertions, 11 deletions
diff --git a/drape_frontend/arrow3d.cpp b/drape_frontend/arrow3d.cpp index 19f7fe7ecd..a4a66e72ce 100644 --- a/drape_frontend/arrow3d.cpp +++ b/drape_frontend/arrow3d.cpp @@ -134,21 +134,21 @@ void Arrow3d::Render(ScreenBase const & screen, ref_ptr<dp::GpuProgramManager> m if (screen.isPerspective()) { ref_ptr<dp::GpuProgram> shadowProgram = mng->GetProgram(gpu::ARROW_3D_SHADOW_PROGRAM); - RenderArrow(screen, shadowProgram, dp::Color(60, 60, 60, 60), 0.05f); + RenderArrow(screen, shadowProgram, dp::Color(60, 60, 60, 60), 0.05f, false /* hasNormals */); } // Render arrow. ref_ptr<dp::GpuProgram> arrowProgram = mng->GetProgram(gpu::ARROW_3D_PROGRAM); - RenderArrow(screen, arrowProgram, - df::GetColorConstant(GetStyleReader().GetCurrentStyle(), - m_obsoletePosition ? df::Arrow3DObsolete : df::Arrow3D), 0.0f); + dp::Color const color = df::GetColorConstant(GetStyleReader().GetCurrentStyle(), + m_obsoletePosition ? df::Arrow3DObsolete : df::Arrow3D); + RenderArrow(screen, arrowProgram, color, 0.0f, true /* hasNormals */); arrowProgram->Unbind(); GLFunctions::glBindBuffer(0, gl_const::GLArrayBuffer); } void Arrow3d::RenderArrow(ScreenBase const & screen, ref_ptr<dp::GpuProgram> program, - dp::Color const & color, float dz) + dp::Color const & color, float dz, bool hasNormals) { program->Bind(); @@ -159,11 +159,14 @@ void Arrow3d::RenderArrow(ScreenBase const & screen, ref_ptr<dp::GpuProgram> pro GLFunctions::glVertexAttributePointer(attributePosition, kComponentsInVertex, gl_const::GLFloatType, false, 0, 0); - GLFunctions::glBindBuffer(m_bufferNormalsId, gl_const::GLArrayBuffer); - uint32_t const attributeNormal = program->GetAttributeLocation("a_normal"); - ASSERT_NOT_EQUAL(attributeNormal, -1, ()); - GLFunctions::glEnableVertexAttribute(attributeNormal); - GLFunctions::glVertexAttributePointer(attributeNormal, 3, gl_const::GLFloatType, false, 0, 0); + if (hasNormals) + { + GLFunctions::glBindBuffer(m_bufferNormalsId, gl_const::GLArrayBuffer); + uint32_t const attributeNormal = program->GetAttributeLocation("a_normal"); + ASSERT_NOT_EQUAL(attributeNormal, -1, ()); + GLFunctions::glEnableVertexAttribute(attributeNormal); + GLFunctions::glVertexAttributePointer(attributeNormal, 3, gl_const::GLFloatType, false, 0, 0); + } dp::UniformValuesStorage uniforms; math::Matrix<float, 4, 4> const modelTransform = CalculateTransform(screen, dz); diff --git a/drape_frontend/arrow3d.hpp b/drape_frontend/arrow3d.hpp index c6916e4197..56128c2b1d 100644 --- a/drape_frontend/arrow3d.hpp +++ b/drape_frontend/arrow3d.hpp @@ -36,7 +36,7 @@ private: void Build(); math::Matrix<float, 4, 4> CalculateTransform(ScreenBase const & screen, float dz) const; void RenderArrow(ScreenBase const & screen, ref_ptr<dp::GpuProgram> program, - dp::Color const & color, float dz); + dp::Color const & color, float dz, bool hasNormals); m2::PointD m_position; double m_azimuth = 0.0; |