forked from organicmaps/organicmaps
Merge pull request #1092 from rokuz/fixed-nexus-9-rendering
Fixed nexus 9 rendering
This commit is contained in:
commit
e31d0702e7
6 changed files with 35 additions and 36 deletions
|
@ -1,4 +1,3 @@
|
|||
attribute vec3 a_position;
|
||||
attribute vec2 a_normal;
|
||||
|
||||
uniform mat4 modelView;
|
||||
|
@ -6,5 +5,5 @@ uniform mat4 projection;
|
|||
|
||||
void main(void)
|
||||
{
|
||||
gl_Position = (vec4(a_normal, 0, 0) + vec4(a_position, 1) * modelView) * projection;
|
||||
gl_Position = vec4(modelView[0][3] + a_normal.x, modelView[1][3] + a_normal.y, modelView[2][3], 1) * projection;
|
||||
}
|
||||
|
|
|
@ -287,6 +287,7 @@ void BackendRenderer::RecacheMyPosition()
|
|||
auto msg = make_unique_dp<MyPositionShapeMessage>(make_unique_dp<MyPosition>(m_texMng),
|
||||
make_unique_dp<SelectionShape>(m_texMng));
|
||||
|
||||
GLFunctions::glFlush();
|
||||
m_commutator->PostMessage(ThreadsCommutator::RenderThread, move(msg), MessagePriority::High);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,15 +36,13 @@ uint32_t BuildRect(vector<Button::ButtonVertex> & vertices,
|
|||
glsl::vec2 const & v3, glsl::vec2 const & v4)
|
||||
|
||||
{
|
||||
glsl::vec3 const position(0.0f, 0.0f, 0.0f);
|
||||
vertices.push_back(Button::ButtonVertex(v1));
|
||||
vertices.push_back(Button::ButtonVertex(v2));
|
||||
vertices.push_back(Button::ButtonVertex(v3));
|
||||
|
||||
vertices.push_back(Button::ButtonVertex(position, v1));
|
||||
vertices.push_back(Button::ButtonVertex(position, v2));
|
||||
vertices.push_back(Button::ButtonVertex(position, v3));
|
||||
|
||||
vertices.push_back(Button::ButtonVertex(position, v3));
|
||||
vertices.push_back(Button::ButtonVertex(position, v2));
|
||||
vertices.push_back(Button::ButtonVertex(position, v4));
|
||||
vertices.push_back(Button::ButtonVertex(v3));
|
||||
vertices.push_back(Button::ButtonVertex(v2));
|
||||
vertices.push_back(Button::ButtonVertex(v4));
|
||||
|
||||
return dp::Batcher::IndexPerQuad;
|
||||
}
|
||||
|
@ -53,23 +51,21 @@ uint32_t BuildCorner(vector<Button::ButtonVertex> & vertices,
|
|||
glsl::vec2 const & pt, double radius,
|
||||
double angleStart, double angleFinish)
|
||||
{
|
||||
glsl::vec3 const position(0.0f, 0.0f, 0.0f);
|
||||
|
||||
int const trianglesCount = 8;
|
||||
double const sector = (angleFinish - angleStart) / static_cast<double>(trianglesCount);
|
||||
int const kTrianglesCount = 8;
|
||||
double const sector = (angleFinish - angleStart) / kTrianglesCount;
|
||||
m2::PointD startNormal(0.0f, radius);
|
||||
|
||||
for (size_t i = 0; i < trianglesCount; ++i)
|
||||
for (size_t i = 0; i < kTrianglesCount; ++i)
|
||||
{
|
||||
m2::PointD normal = m2::Rotate(startNormal, angleStart + i * sector);
|
||||
m2::PointD nextNormal = m2::Rotate(startNormal, angleStart + (i + 1) * sector);
|
||||
|
||||
vertices.push_back(Button::ButtonVertex(position, pt));
|
||||
vertices.push_back(Button::ButtonVertex(position, pt - glsl::ToVec2(normal)));
|
||||
vertices.push_back(Button::ButtonVertex(position, pt - glsl::ToVec2(nextNormal)));
|
||||
vertices.push_back(Button::ButtonVertex(pt));
|
||||
vertices.push_back(Button::ButtonVertex(pt - glsl::ToVec2(normal)));
|
||||
vertices.push_back(Button::ButtonVertex(pt - glsl::ToVec2(nextNormal)));
|
||||
}
|
||||
|
||||
return trianglesCount * dp::Batcher::IndexPerTriangle;
|
||||
return kTrianglesCount * dp::Batcher::IndexPerTriangle;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -189,21 +185,14 @@ dp::BindingInfo const & Button::ButtonVertex::GetBindingInfo()
|
|||
|
||||
if (info == nullptr)
|
||||
{
|
||||
info.reset(new dp::BindingInfo(2));
|
||||
info.reset(new dp::BindingInfo(1));
|
||||
|
||||
dp::BindingDecl & posDecl = info->GetBindingDecl(0);
|
||||
posDecl.m_attributeName = "a_position";
|
||||
posDecl.m_componentCount = 3;
|
||||
posDecl.m_componentType = gl_const::GLFloatType;
|
||||
posDecl.m_offset = 0;
|
||||
posDecl.m_stride = sizeof(ButtonVertex);
|
||||
|
||||
dp::BindingDecl & normalDecl = info->GetBindingDecl(1);
|
||||
dp::BindingDecl & normalDecl = info->GetBindingDecl(0);
|
||||
normalDecl.m_attributeName = "a_normal";
|
||||
normalDecl.m_componentCount = 2;
|
||||
normalDecl.m_componentType = gl_const::GLFloatType;
|
||||
normalDecl.m_offset = sizeof(glsl::vec3);
|
||||
normalDecl.m_stride = posDecl.m_stride;
|
||||
normalDecl.m_offset = 0;
|
||||
normalDecl.m_stride = sizeof(ButtonVertex);
|
||||
}
|
||||
|
||||
return *info.get();
|
||||
|
|
|
@ -33,15 +33,12 @@ public:
|
|||
struct ButtonVertex
|
||||
{
|
||||
ButtonVertex() = default;
|
||||
ButtonVertex(glsl::vec3 const & position, glsl::vec2 const & normal)
|
||||
: m_position(position)
|
||||
, m_normal(normal)
|
||||
{
|
||||
}
|
||||
ButtonVertex(glsl::vec2 const & normal)
|
||||
: m_normal(normal)
|
||||
{}
|
||||
|
||||
static dp::BindingInfo const & GetBindingInfo();
|
||||
|
||||
glsl::vec3 m_position;
|
||||
glsl::vec2 m_normal;
|
||||
};
|
||||
|
||||
|
|
|
@ -176,6 +176,9 @@ drape_ptr<LayerRenderer> LayerCacher::RecacheWidgets(TWidgetsInitInfo const & in
|
|||
sizeInfo[node.first] = cacheFunction->second(node.second, make_ref(renderer), textures);
|
||||
}
|
||||
|
||||
// Flush gui geometry.
|
||||
GLFunctions::glFlush();
|
||||
|
||||
return renderer;
|
||||
}
|
||||
|
||||
|
@ -191,6 +194,10 @@ drape_ptr<LayerRenderer> LayerCacher::RecacheCountryStatus(ref_ptr<dp::TextureMa
|
|||
RegisterButtonHandler(handlers, CountryStatusHelper::BUTTON_TRY_AGAIN);
|
||||
|
||||
renderer->AddShapeRenderer(WIDGET_COUNTRY_STATUS, countryStatus.Draw(textures, handlers));
|
||||
|
||||
// Flush gui geometry.
|
||||
GLFunctions::glFlush();
|
||||
|
||||
return renderer;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,9 @@ void RouteBuilder::Build(m2::PolylineD const & routePolyline, vector<double> con
|
|||
routeData->m_sourceTurns = turns;
|
||||
RouteShape(params).Draw(textures, *routeData.get());
|
||||
|
||||
// Flush route geometry.
|
||||
GLFunctions::glFlush();
|
||||
|
||||
if (m_flushRouteFn != nullptr)
|
||||
m_flushRouteFn(move(routeData));
|
||||
}
|
||||
|
@ -45,6 +48,9 @@ void RouteBuilder::BuildSign(m2::PointD const & pos, bool isStart, bool isValid,
|
|||
RouteShape(params).CacheRouteSign(textures, *routeSignData.get());
|
||||
}
|
||||
|
||||
// Flush route sign geometry.
|
||||
GLFunctions::glFlush();
|
||||
|
||||
if (m_flushRouteSignFn != nullptr)
|
||||
m_flushRouteSignFn(move(routeSignData));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue