diff --git a/iphone/Maps/Classes/RenderContext.mm b/iphone/Maps/Classes/RenderContext.mm index c6927ada12..b29a47e5e1 100644 --- a/iphone/Maps/Classes/RenderContext.mm +++ b/iphone/Maps/Classes/RenderContext.mm @@ -29,8 +29,9 @@ namespace iphone void RenderContext::makeCurrent() { [EAGLContext setCurrentContext:m_context]; + yg::gl::RenderContext::initParams(); } - + shared_ptr RenderContext::createShared() { return shared_ptr(new RenderContext(this)); diff --git a/map/framework.cpp b/map/framework.cpp index 383a7a4363..5b33655d3d 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -9,6 +9,8 @@ #include "../platform/settings.hpp" +#include "../yg/rendercontext.hpp" + #include "../search/search_engine.hpp" #include "../search/result.hpp" #include "../search/categories_holder.hpp" @@ -179,6 +181,7 @@ void Framework::InitializeGL( shared_ptr const & primaryContext, shared_ptr const & resourceManager) { + yg::gl::RenderContext::initParams(); m_renderPolicy->Initialize(primaryContext, resourceManager); } diff --git a/map/qgl_render_context.cpp b/map/qgl_render_context.cpp index 6525860b96..14865bd576 100644 --- a/map/qgl_render_context.cpp +++ b/map/qgl_render_context.cpp @@ -30,6 +30,7 @@ namespace qt void RenderContext::makeCurrent() { m_context->makeCurrent(); + yg::gl::RenderContext::initParams(); } shared_ptr RenderContext::createShared() diff --git a/yg/base_texture.cpp b/yg/base_texture.cpp index 4e4cfa915d..dc1a831490 100644 --- a/yg/base_texture.cpp +++ b/yg/base_texture.cpp @@ -20,9 +20,6 @@ namespace yg OGLCHECK(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)); OGLCHECK(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); OGLCHECK(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); - - OGLCHECK(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); - OGLCHECK(glPixelStorei(GL_PACK_ALIGNMENT, 1)); } BaseTexture::BaseTexture(m2::PointU const & size) diff --git a/yg/rendercontext.cpp b/yg/rendercontext.cpp new file mode 100644 index 0000000000..2619d4b2d7 --- /dev/null +++ b/yg/rendercontext.cpp @@ -0,0 +1,15 @@ +#include "../base/SRC_FIRST.hpp" +#include "rendercontext.hpp" +#include "internal/opengl.hpp" + +namespace yg +{ + namespace gl + { + void RenderContext::initParams() + { + OGLCHECK(glPixelStorei(GL_UNPACK_ALIGNMENT, 1)); + OGLCHECK(glPixelStorei(GL_PACK_ALIGNMENT, 1)); + } + } +} diff --git a/yg/rendercontext.hpp b/yg/rendercontext.hpp index 97232debda..7ff41a2af2 100644 --- a/yg/rendercontext.hpp +++ b/yg/rendercontext.hpp @@ -16,6 +16,10 @@ namespace yg virtual shared_ptr createShared() = 0; /// called at the end of thread virtual void endThreadDrawing() = 0; + /// !! IMPORTANT !! + /// this function must be called from each opengl + /// thread to setup texture related params + static void initParams(); }; } } diff --git a/yg/yg.pro b/yg/yg.pro index b1744d0cf4..3c6a081f00 100644 --- a/yg/yg.pro +++ b/yg/yg.pro @@ -60,7 +60,8 @@ SOURCES += \ styles_cache.cpp \ composite_overlay_element.cpp \ path_text_element.cpp \ - straight_text_element.cpp + straight_text_element.cpp \ + rendercontext.cpp HEADERS += \ internal/opengl.hpp \