mat4 projection = mat4(1.0f);
projection = perspective(radians(45.0f), 1.0f, 0.0f, 100.0f);
顶点着色器:
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec2 aTexCoord;
uniform mat4 transform;
uniform mat4 view;
uniform mat4 projection;
out vec2 TexCoord;
void main(){
gl_Position = projection * view * transform * vec4(aPos, 1.0);
TexCoord = aTexCoord;
}
片元着色器:
#version 330 core
out vec4 FragColor;
in vec2 TexCoord;
uniform float mixControl;
uniform sampler2D ourTexture;
uniform sampler2D ourTexture1;
void main(){
FragColor = mix(texture(ourTexture, TexCoord), texture(ourTexture1, vec2(1.0 - TexCoord.x, TexCoord.y)), mixControl);
}