diff --git a/drape/glconstants.cpp b/drape/glconstants.cpp index aef150ccd2..337514c47b 100644 --- a/drape/glconstants.cpp +++ b/drape/glconstants.cpp @@ -125,6 +125,14 @@ const glConst GLOneMinusDstAlfa = GL_ONE_MINUS_DST_ALPHA; const glConst GLDepthTest = GL_DEPTH_TEST; const glConst GLBlending = GL_BLEND; +const glConst GLCullFace = GL_CULL_FACE; + +const glConst GLClockwise = GL_CW; +const glConst GLCounterClockwise = GL_CCW; + +const glConst GLFront = GL_FRONT; +const glConst GLBack = GL_BACK; +const glConst GLFrontAndBack = GL_FRONT_AND_BACK; const glConst GLNever = GL_NEVER; const glConst GLLess = GL_LESS; diff --git a/drape/glconstants.hpp b/drape/glconstants.hpp index c5deea0a7a..df2d3902dc 100644 --- a/drape/glconstants.hpp +++ b/drape/glconstants.hpp @@ -113,6 +113,16 @@ extern const glConst GLOneMinusDstAlfa; /// OpenGL states extern const glConst GLDepthTest; extern const glConst GLBlending; +extern const glConst GLCullFace; + +/// Triangle faces order +extern const glConst GLClockwise; +extern const glConst GLCounterClockwise; + +/// Triangle face +extern const glConst GLFront; +extern const glConst GLBack; +extern const glConst GLFrontAndBack; /// OpenGL depth functions extern const glConst GLNever; diff --git a/drape/glfunctions.cpp b/drape/glfunctions.cpp index 69392b331e..5502111368 100644 --- a/drape/glfunctions.cpp +++ b/drape/glfunctions.cpp @@ -259,6 +259,16 @@ void GLFunctions::glFinish() GLCHECK(::glFinish()); } +void GLFunctions::glFrontFace(glConst mode) +{ + GLCHECK(::glFrontFace(mode)); +} + +void GLFunctions::glCullFace(glConst face) +{ + GLCHECK(::glCullFace(face)); +} + void GLFunctions::glPixelStore(glConst name, uint32_t value) { GLCHECK(::glPixelStorei(name, value)); diff --git a/drape/glfunctions.hpp b/drape/glfunctions.hpp index 4ba325784d..172eca8d10 100644 --- a/drape/glfunctions.hpp +++ b/drape/glfunctions.hpp @@ -19,6 +19,9 @@ public: static void glFlush(); static void glFinish(); + static void glFrontFace(glConst mode); + static void glCullFace(glConst face); + static void glPixelStore(glConst name, uint32_t value); static int32_t glGetInteger(glConst pname); diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp index 5c2d77e4e2..7251d87e69 100644 --- a/drape_frontend/frontend_renderer.cpp +++ b/drape_frontend/frontend_renderer.cpp @@ -396,6 +396,10 @@ void FrontendRenderer::Routine::Do() GLFunctions::glDepthFunc(gl_const::GLLessOrEqual); GLFunctions::glDepthMask(true); + GLFunctions::glFrontFace(gl_const::GLClockwise); + GLFunctions::glCullFace(gl_const::GLBack); + GLFunctions::glEnable(gl_const::GLCullFace); + my::Timer timer; //double processingTime = InitAvarageTimePerMessage; // By init we think that one message processed by 1ms diff --git a/drape_head/testing_engine.cpp b/drape_head/testing_engine.cpp index d680ceca88..228dabc3c7 100644 --- a/drape_head/testing_engine.cpp +++ b/drape_head/testing_engine.cpp @@ -10,6 +10,7 @@ #include "drape_frontend/path_symbol_shape.hpp" #include "drape_frontend/area_shape.hpp" #include "drape_frontend/circle_shape.hpp" +#include "drape_frontend/poi_symbol_shape.hpp" #include "drape/utils/vertex_decl.hpp" #include "drape/glsl_types.hpp" @@ -315,6 +316,10 @@ void TestingEngine::Draw() GLFunctions::glClear(); GLFunctions::glEnable(gl_const::GLDepthTest); + GLFunctions::glFrontFace(gl_const::GLClockwise); + GLFunctions::glCullFace(gl_const::GLBack); + GLFunctions::glEnable(gl_const::GLCullFace); + TScene::iterator it = m_scene.begin(); for(; it != m_scene.end(); ++it) { @@ -383,14 +388,14 @@ void TestingEngine::DrawImpl() vector path; path.push_back(m2::PointD(92.277071f, 50.9271164f)); path.push_back(m2::PointD(98.277071f, 50.9271164f)); - path.push_back(m2::PointD(106.277071f, 45.9271164f)); + path.push_back(m2::PointD(106.277071f, 48.9271164f)); m2::SharedSpline spline(path); PathTextViewParams ptvp; ptvp.m_baseGtoPScale = 1.0f / m_modelView.GetScale(); ptvp.m_depth = 100.0f; - ptvp.m_text = "Some text along path"; - ptvp.m_textFont = FontDecl(dp::Color::Black(), 40); + ptvp.m_text = "Some text"; + ptvp.m_textFont = FontDecl(dp::Color::Black(), 40, dp::Color::Red()); PathTextShape(spline, ptvp).Draw(m_batcher.GetRefPointer(), m_textures.GetRefPointer()); LineViewParams lvp; @@ -402,6 +407,16 @@ void TestingEngine::DrawImpl() lvp.m_join = dp::BevelJoin; LineShape(spline, lvp).Draw(m_batcher.GetRefPointer(), m_textures.GetRefPointer()); + { + PathSymbolViewParams p; + p.m_depth = 95.0f; + p.m_baseGtoPScale = ptvp.m_baseGtoPScale; + p.m_offset = 0.0f; + p.m_step = 60.0f; + p.m_symbolName = "swimming"; + PathSymbolShape(spline, p).Draw(m_batcher.GetRefPointer(), m_textures.GetRefPointer()); + } + { vector path1; path1.push_back(m2::PointD(92.277071f, 45.9271164f)); @@ -418,6 +433,30 @@ void TestingEngine::DrawImpl() lvp.m_color = dp::Color::Black(); LineShape(spl1, lvp).Draw(m_batcher.GetRefPointer(), m_textures.GetRefPointer()); } + + { + PoiSymbolViewParams p(FeatureID(-1, 0)); + p.m_depth = 0.0f; + p.m_symbolName = "subway-station-l"; + PoiSymbolShape(m2::PointF(92.27f, 30.0f), p).Draw(m_batcher.GetRefPointer(), m_textures.GetRefPointer()); + } + + { + CircleViewParams p(FeatureID(-1, 0)); + p.m_color = dp::Color::Red(); + p.m_depth = 0.0f; + p.m_radius = 28.0f; + CircleShape(m2::PointF(94.27f, 30.0f), p).Draw(m_batcher.GetRefPointer(), m_textures.GetRefPointer()); + } + + { + vector trg{ m2::PointD(110.0f, 30.0f), m2::PointD(112.0f, 30.0f), m2::PointD(112.0f, 28.0f), + m2::PointD(110.0f, 30.0f), m2::PointD(112.0f, 28.0f), m2::PointD(110.0f, 28.0f) }; + AreaViewParams p; + p.m_color = dp::Color::White(); + p.m_depth = 0.0f; + AreaShape(move(trg), p).Draw(m_batcher.GetRefPointer(), m_textures.GetRefPointer()); + } } void TestingEngine::DrawRects()