1 /***************************************************************************
3 * Copyright 2010,2011 BMW Car IT GmbH
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 ****************************************************************************/
20 // Vertex position. Will be in range 0 to 1
21 attribute highp vec2 aPosition;
22 attribute highp vec2 aTexCoords;
24 // normalized window position
25 // (0, 0 is upper left, 1, 1 is lower right)
26 uniform mediump float uX;
27 uniform mediump float uY;
29 // normalized window size
30 // 1.0 will cover the entire viewport
31 uniform mediump float uWidth;
32 uniform mediump float uHeight;
34 // texrange describes the width and height of texture area which should be rendered
35 uniform mediump vec2 uTexRange;
36 // texrange describes the x and y position of the texture area which should be rendered
37 uniform mediump vec2 uTexOffset;
39 // texture coordinates
40 varying mediump vec2 vTexout;
44 // Get the size correct. Multiply by 2 because -1 to +1 is mapped to
46 gl_Position.xy = 2.0 * aPosition.xy * vec2( uWidth, uHeight); // rechte seite des fensters: volle breite sonst 0
47 gl_Position.xy += vec2(uX * 2.0 - 1.0+0.5, 1.0 - ((uY + uHeight)* 2.0));
48 gl_Position.zw = vec2(0.0, 1.0);
49 vTexout = vec2(uTexOffset.x + uTexRange.x * aTexCoords.x,1.0-(uTexOffset.y + aTexCoords.y*uTexRange.y+(1.0-uTexRange.y)));