-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvertex.vert
More file actions
23 lines (18 loc) · 792 Bytes
/
vertex.vert
File metadata and controls
23 lines (18 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// our vertex data
attribute vec3 aPosition;
// our texcoordinates
attribute vec2 aTexCoord;
// this is a variable that will be shared with the fragment shader
// we will assign the attribute texcoords to the varying texcoords to move them from the vert shader to the frag shader
// it can be called whatever you want but often people prefiv it with 'v' to indicate that it is a varying
varying vec2 vTexCoord;
void main() {
// copy the texture coordinates
vTexCoord = aTexCoord;
// copy the position data into a vec4, using 1.0 as the w component
vec4 positionVec4 = vec4(aPosition, 1.0);
positionVec4.xy = positionVec4.xy * 2.0 - 1.0;
// positionVec4.x *= aPosition.x / aPosition.y;
// send the vertex information on to the fragment shader
gl_Position = positionVec4;
}