diff --git a/data/results.unicode b/data/results.unicode deleted file mode 100644 index 561700728c..0000000000 Binary files a/data/results.unicode and /dev/null differ diff --git a/map/render_queue_routine.cpp b/map/render_queue_routine.cpp index 24e0de37df..010b7e20f0 100644 --- a/map/render_queue_routine.cpp +++ b/map/render_queue_routine.cpp @@ -63,12 +63,12 @@ void RenderQueueRoutine::processResize(ScreenBase const & /*frameScreen*/) m_renderState->m_backBuffer = make_shared_ptr(new yg::gl::RawRGBA8Texture(texW, texH)); m_renderState->m_depthBuffer.reset(); - m_renderState->m_depthBuffer = make_shared_ptr(new yg::gl::RenderBuffer(texW, texH, true)); if (!m_isMultiSampled) - m_threadDrawer->screen()->setRenderTarget(m_renderState->m_backBuffer); - - m_threadDrawer->screen()->frameBuffer()->setDepthBuffer(m_renderState->m_depthBuffer); + { + m_renderState->m_depthBuffer = make_shared_ptr(new yg::gl::RenderBuffer(texW, texH, true)); + m_threadDrawer->screen()->frameBuffer()->setDepthBuffer(m_renderState->m_depthBuffer); + } m_threadDrawer->onSize(texW, texH); diff --git a/yg/base_texture.hpp b/yg/base_texture.hpp index a028060a90..8b3ffb7ab3 100644 --- a/yg/base_texture.hpp +++ b/yg/base_texture.hpp @@ -6,6 +6,7 @@ namespace yg { + class Color; namespace gl { class BaseTexture : public RenderTarget @@ -39,6 +40,7 @@ namespace yg m2::RectF const mapRect(m2::RectF const & r) const; void mapPixel(float & x, float & y) const; + virtual void fill(yg::Color const & c) = 0; virtual void dump(char const * fileName) = 0; static unsigned current(); diff --git a/yg/glyph_cache.cpp b/yg/glyph_cache.cpp index 4ff657b1f3..ee4f39dbf4 100644 --- a/yg/glyph_cache.cpp +++ b/yg/glyph_cache.cpp @@ -80,7 +80,7 @@ namespace yg { FTCHECK(FT_Init_FreeType(&m_impl->m_lib)); FTCHECK(FT_Stroker_New(m_impl->m_lib, &m_impl->m_stroker)); - FT_Stroker_Set(m_impl->m_stroker, 3 * 64, FT_STROKER_LINECAP_ROUND, FT_STROKER_LINEJOIN_ROUND, 0); + FT_Stroker_Set(m_impl->m_stroker, 2 * 64, FT_STROKER_LINECAP_ROUND, FT_STROKER_LINEJOIN_ROUND, 0); } GlyphCache::~GlyphCache() diff --git a/yg/renderer.cpp b/yg/renderer.cpp index 2047b99687..2cac044986 100644 --- a/yg/renderer.cpp +++ b/yg/renderer.cpp @@ -10,13 +10,14 @@ namespace yg { namespace gl { - Renderer::Renderer() : m_isMultiSampled(false) + Renderer::Renderer() : m_isMultiSampled(false), m_isRendering(false) { m_multiSampledFrameBuffer = make_shared_ptr(new FrameBuffer()); } void Renderer::beginFrame() { + m_isRendering = true; if (m_isMultiSampled) m_multiSampledFrameBuffer->makeCurrent(); else @@ -24,10 +25,16 @@ namespace yg m_frameBuffer->makeCurrent(); } + bool Renderer::isRendering() const + { + return m_isRendering; + } + void Renderer::endFrame() { // if (m_isMultiSampled) updateFrameBuffer(); + m_isRendering = false; } shared_ptr const & Renderer::frameBuffer() const @@ -52,10 +59,11 @@ namespace yg void Renderer::setRenderTarget(shared_ptr const & rt) { - updateFrameBuffer(); + if (isRendering()) + updateFrameBuffer(); m_frameBuffer->setRenderTarget(rt); - m_frameBuffer->makeCurrent(); + m_frameBuffer->makeCurrent(); //< to attach renderTarget if (m_isMultiSampled) m_multiSampledFrameBuffer->makeCurrent(); @@ -74,6 +82,9 @@ namespace yg OGLCHECK(glBindFramebufferOES(GL_DRAW_FRAMEBUFFER_APPLE, m_multiSampledFrameBuffer->id())); #else + /// Somehow this does the trick with the "trash-texture" upon first application redraw. + m_multiSampledFrameBuffer->makeCurrent(); + OGLCHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_multiSampledFrameBuffer->id())); OGLCHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_frameBuffer->id())); OGLCHECK(glBlitFramebuffer(0, 0, width(), height(), diff --git a/yg/renderer.hpp b/yg/renderer.hpp index 02d02b450a..daefbd386c 100644 --- a/yg/renderer.hpp +++ b/yg/renderer.hpp @@ -25,6 +25,8 @@ namespace yg bool m_isMultiSampled; + bool m_isRendering; + unsigned int m_width; unsigned int m_height; @@ -35,6 +37,8 @@ namespace yg void beginFrame(); void endFrame(); + bool isRendering() const; + void setIsMultiSampled(bool isMultiSampled); bool isMultiSampled() const; diff --git a/yg/texture.hpp b/yg/texture.hpp index 12684ff546..3faa0c7ebb 100644 --- a/yg/texture.hpp +++ b/yg/texture.hpp @@ -65,7 +65,45 @@ namespace yg upload(0); } - void dump(char const *){} + void fill(yg::Color const & c) + { + makeCurrent(); + + typename Traits::image_t image(width(), height()); + + typename Traits::pixel_t val((c.r / 255.0f) * Traits::maxChannelVal, + (c.g / 255.0f) * Traits::maxChannelVal, + (c.b / 255.0f) * Traits::maxChannelVal, + (c.a / 255.0f) * Traits::maxChannelVal); + + typename Traits::view_t v = gil::view(image); + + for (size_t y = 0; y < height(); ++y) + for (size_t x = 0; x < width(); ++x) + v(x, y) = val; + + upload(&v(0, 0)); + } + + void dump(char const * fileName) + { + makeCurrent(); + std::string const fullPath = GetPlatform().WritablePathForFile(fileName); + + typename Traits::image_t image(width(), height()); + +#ifndef OMIM_GL_ES + OGLCHECK(glGetTexImage( + GL_TEXTURE_2D, + 0, + GL_RGBA, + Traits::gl_pixel_data_type, + &gil::view(image)(0, 0))); + boost::gil::lodepng_write_view(fullPath.c_str(), gil::view(image)); +#endif + + + } }; template @@ -215,27 +253,29 @@ namespace yg template void Texture::readback() { -/* makeCurrent(); + makeCurrent(); #ifndef OMIM_GL_ES OGLCHECK(glGetTexImage( GL_TEXTURE_2D, 0, GL_RGBA, Traits::gl_pixel_data_type, - &gil::view(m_image)(0, 0))); + &view(width(), height())(0, 0))); #else ASSERT(false, ("no glGetTexImage function in OpenGL ES")); -#endif*/ +#endif } template - void Texture::dump(char const * /*fileName*/) + void Texture::dump(char const * fileName) { -/* readback(); + lock(); + readback(); std::string const fullPath = GetPlatform().WritablePathForFile(fileName); #ifndef OMIM_GL_ES - boost::gil::lodepng_write_view(fullPath.c_str(), gil::const_view(m_image)); -#endif*/ + boost::gil::lodepng_write_view(fullPath.c_str(), view(width(), height())); +#endif + unlock(); } template