Textures_ a practice

Modifying the fragment shader, only so smiley face look in another direction

 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 }
View Code

The correspondence between the vertex and texture coordinates change what you can, corresponding to the upper right upper left, upper right corresponds to the upper left .... and replaced expression is 1.0 - TexCoord.x

 

2019/11/27

Guess you like

Origin www.cnblogs.com/ljy08163268/p/11945122.html