diff --git a/drape_frontend/framebuffer.cpp b/drape_frontend/framebuffer.cpp index 73cbc88ac6..2a9fe67116 100644 --- a/drape_frontend/framebuffer.cpp +++ b/drape_frontend/framebuffer.cpp @@ -11,7 +11,7 @@ namespace df { -Framebuffer::Framebuffer() : m_maxTextureSize(GLFunctions::glGetInteger(gl_const::GLMaxTextureSize)) +Framebuffer::Framebuffer() { } @@ -44,8 +44,10 @@ void Framebuffer::SetDefaultContext(dp::OGLContext * context) m_defaultContext = context; } -int32_t Framebuffer::GetMaxSize() const +int32_t Framebuffer::GetMaxSize() { + if (m_maxTextureSize == 0) + m_maxTextureSize = GLFunctions::glGetInteger(gl_const::GLMaxTextureSize); return m_maxTextureSize; } diff --git a/drape_frontend/framebuffer.hpp b/drape_frontend/framebuffer.hpp index 7d2b30b942..79566de482 100644 --- a/drape_frontend/framebuffer.hpp +++ b/drape_frontend/framebuffer.hpp @@ -19,7 +19,7 @@ public: void SetDefaultContext(dp::OGLContext * context); void SetSize(uint32_t width, uint32_t height); - int32_t GetMaxSize() const; + int32_t GetMaxSize(); void Enable(); void Disable(); @@ -38,7 +38,7 @@ private: dp::OGLContext * m_defaultContext = 0; - int32_t const m_maxTextureSize; + int32_t m_maxTextureSize = 0; }; } // namespace df diff --git a/drape_frontend/renderer3d.cpp b/drape_frontend/renderer3d.cpp index 81a1b24ed3..6e7f04779d 100644 --- a/drape_frontend/renderer3d.cpp +++ b/drape_frontend/renderer3d.cpp @@ -46,16 +46,22 @@ void Renderer3d::Build(ref_ptr prg) GLFunctions::glBindVertexArray(m_VAO); int8_t attributeLocation = prg->GetAttributeLocation("a_pos"); - assert(attributeLocation != -1); + ASSERT_NOT_EQUAL(attributeLocation, -1, ()); GLFunctions::glEnableVertexAttribute(attributeLocation); GLFunctions::glVertexAttributePointer(attributeLocation, 2, gl_const::GLFloatType, false, sizeof(float) * 4, 0); attributeLocation = prg->GetAttributeLocation("a_tcoord"); - assert(attributeLocation != -1); + ASSERT_NOT_EQUAL(attributeLocation, -1, ()); GLFunctions::glEnableVertexAttribute(attributeLocation); GLFunctions::glVertexAttributePointer(attributeLocation, 2, gl_const::GLFloatType, false, sizeof(float) * 4, sizeof(float) * 2); + + GLFunctions::glBufferData(gl_const::GLArrayBuffer, m_vertices.size() * sizeof(m_vertices[0]), + m_vertices.data(), gl_const::GLStaticDraw); + + GLFunctions::glBindVertexArray(0); + GLFunctions::glBindBuffer(0, gl_const::GLArrayBuffer); } void Renderer3d::Render(ScreenBase const & screen, uint32_t textureId, ref_ptr mng) @@ -81,9 +87,6 @@ void Renderer3d::Render(ScreenBase const & screen, uint32_t textureId, ref_ptr