From 14d8bb23901687b4b580ebb08a474c02f6315677 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Mon, 19 Dec 2016 09:17:11 +0100 Subject: [PATCH] Calculate correct texture coordinates on created primitives --- src/anbox/graphics/emugl/Renderer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/anbox/graphics/emugl/Renderer.cpp b/src/anbox/graphics/emugl/Renderer.cpp index df87730..5db5319 100644 --- a/src/anbox/graphics/emugl/Renderer.cpp +++ b/src/anbox/graphics/emugl/Renderer.cpp @@ -996,7 +996,7 @@ void Renderer::setupViewport(RendererWindow *window, void Renderer::tessellate(std::vector &primitives, const anbox::graphics::Rect &buf_size, const Renderable &renderable) { - auto rect = renderable.crop(); + auto rect = renderable.screen_position(); GLfloat left = rect.left(); GLfloat right = rect.right(); GLfloat top = rect.top(); @@ -1006,10 +1006,10 @@ void Renderer::tessellate(std::vector &primitives, rectangle.tex_id = 0; rectangle.type = GL_TRIANGLE_STRIP; - GLfloat tex_left = static_cast(left) / buf_size.width(); - GLfloat tex_top = static_cast(top) / buf_size.height(); - GLfloat tex_right = static_cast(right) / buf_size.width(); - GLfloat tex_bottom = static_cast(bottom) / buf_size.height(); + GLfloat tex_left = static_cast(renderable.crop().left()) / buf_size.width(); + GLfloat tex_top = static_cast(renderable.crop().top()) / buf_size.height(); + GLfloat tex_right = static_cast(renderable.crop().right()) / buf_size.width(); + GLfloat tex_bottom = static_cast(renderable.crop().bottom()) / buf_size.height(); auto &vertices = rectangle.vertices; vertices[0] = {{left, top, 0.0f}, {tex_left, tex_top}};