From f945b896c16b2e015bf184337e2877787936086b Mon Sep 17 00:00:00 2001 From: ExMix Date: Tue, 11 Aug 2015 13:57:43 +0300 Subject: [PATCH] [drape] use strict depth comporation for cap-join --- drape/glstate.cpp | 12 ++++++++++++ drape/glstate.hpp | 4 ++++ drape_frontend/line_shape.cpp | 1 + 3 files changed, 17 insertions(+) diff --git a/drape/glstate.cpp b/drape/glstate.cpp index d0319c1966..0b0986da94 100644 --- a/drape/glstate.cpp +++ b/drape/glstate.cpp @@ -47,11 +47,22 @@ bool Blending::operator == (Blending const & other) const GLState::GLState(uint32_t gpuProgramIndex, DepthLayer depthLayer) : m_gpuProgramIndex(gpuProgramIndex) , m_depthLayer(depthLayer) + , m_depthFunction(gl_const::GLLessOrEqual) , m_colorTexture(nullptr) , m_maskTexture(nullptr) { } +glConst GLState::GetDepthFunction() const +{ + return m_depthFunction; +} + +void GLState::SetDepthFunction(glConst functionName) +{ + m_depthFunction = functionName; +} + bool GLState::operator<(GLState const & other) const { if (m_depthLayer != other.m_depthLayer) @@ -118,6 +129,7 @@ void ApplyState(GLState state, ref_ptr program) { ApplyTextures(state, program); ApplyBlending(state, program); + GLFunctions::glDepthFunc(state.GetDepthFunction()); } } diff --git a/drape/glstate.hpp b/drape/glstate.hpp index 4d06a45855..d77360ce4e 100644 --- a/drape/glstate.hpp +++ b/drape/glstate.hpp @@ -59,6 +59,9 @@ public: int GetProgramIndex() const { return m_gpuProgramIndex; } + glConst GetDepthFunction() const; + void SetDepthFunction(glConst functionName); + bool operator<(GLState const & other) const; bool operator==(GLState const & other) const; @@ -66,6 +69,7 @@ private: uint32_t m_gpuProgramIndex; DepthLayer m_depthLayer; Blending m_blending; + glConst m_depthFunction; ref_ptr m_colorTexture; ref_ptr m_maskTexture; diff --git a/drape_frontend/line_shape.cpp b/drape_frontend/line_shape.cpp index d10d2ac6fe..c31037e714 100644 --- a/drape_frontend/line_shape.cpp +++ b/drape_frontend/line_shape.cpp @@ -252,6 +252,7 @@ public: dp::GLState state(gpu::CAP_JOIN_PROGRAM, dp::GLState::GeometryLayer); state.SetColorTexture(m_params.m_color.GetTexture()); + state.SetDepthFunction(gl_const::GLLess); return state; }