修改片段着色器,仅让笑脸图案朝另一个方向看
1 #version 330 core 2 out vec4 FragColor; 3 4 in vec3 ourColor; 5 in vec2 TexCoord; 6 7 uniform sampler2D ourTexture1; 8 uniform sampler2D ourTexture2; 9 10 void main() 11 { 12 FragColor = mix(texture(ourTexture1, TexCoord), texture(ourTexture2, vec2(1.0 - TexCoord.x, TexCoord.y)), 0.2); 13 }
将顶点和纹理坐标的对应关系改变一下即可,左上对应右上,右上对应左上....,换成表达式就是1.0 - TexCoord.x
2019/11/27