uniform mat4 uMVPMatrix; //总变换矩阵 attribute vec3 aPosition; //顶点位置 attribute vec2 aTexCoor; //顶点纹理坐标 varying vec2 vTextureCoord; //用于传递给片元着色器的变量 varying float rTemp; //用于传递给片元着色器的顶点坐标的变量 varying float currY; void main() { gl_Position = uMVPMatrix * vec4(aPosition,1); //根据总变换矩阵计算此次绘制此顶点位置 vTextureCoord = aTexCoor;//将接收的纹理坐标传递给片元着色器 currY=aPosition.y; rTemp=aPosition.x*aPosition.x+aPosition.y*aPosition.y;//求山上距离原点坐标的距离 }