diff --git a/src/scenegraph/elevatedrectangle.vert b/src/scenegraph/elevatedrectangle.vert index 38d65e10..03ca8f80 100644 --- a/src/scenegraph/elevatedrectangle.vert +++ b/src/scenegraph/elevatedrectangle.vert @@ -1,34 +1,32 @@ /* * Copyright 2020 Arjen Hiemstra * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ uniform highp mat4 matrix; uniform lowp vec2 aspect; uniform lowp vec2 offset; attribute highp vec4 in_vertex; attribute mediump vec2 in_uv; varying mediump vec2 uv; void main() { - lowp vec2 topLeft = vec2(-1.0) - abs(offset) / 2.0; - lowp vec2 bottomRight = vec2(1.0) + abs(offset) / 2.0; - uv = topLeft + (bottomRight - topLeft) * in_uv * aspect; + uv = (-1.0 + 2.0 * in_uv) * aspect; gl_Position = matrix * in_vertex; }