初次提交
This commit is contained in:
10
第14章 片元着色器的妙用/Sample14_6/assets/frag_tex.sh
Normal file
10
第14章 片元着色器的妙用/Sample14_6/assets/frag_tex.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
precision mediump float;
|
||||
varying vec2 vTextureCoord;//接收从顶点着色器过来的参数
|
||||
uniform sampler2D sTexture1;//纹理内容数据1
|
||||
uniform sampler2D sTexture2;//纹理内容数据2
|
||||
uniform float uT;
|
||||
void main() {
|
||||
vec4 color1 = texture2D(sTexture1, vTextureCoord); //从纹理中采样出颜色值1
|
||||
vec4 color2 = texture2D(sTexture2, vTextureCoord); //从纹理中采样出颜色值2
|
||||
gl_FragColor = color1*(1.0-uT) + color2*uT;// 混合两个颜色值
|
||||
}
|
||||
9
第14章 片元着色器的妙用/Sample14_6/assets/vertex_tex.sh
Normal file
9
第14章 片元着色器的妙用/Sample14_6/assets/vertex_tex.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
uniform mat4 uMVPMatrix; //总变换矩阵
|
||||
attribute vec3 aPosition; //顶点位置
|
||||
attribute vec2 aTexCoor; //顶点纹理坐标
|
||||
varying vec2 vTextureCoord; //用于传递给片元着色器的变量
|
||||
void main()
|
||||
{
|
||||
gl_Position = uMVPMatrix * vec4(aPosition,1); //根据总变换矩阵计算此次绘制此顶点位置
|
||||
vTextureCoord = aTexCoor;//将接收的纹理坐标传递给片元着色器
|
||||
}
|
||||
Reference in New Issue
Block a user