mirror of
https://github.com/LearnOpenGL-CN/LearnOpenGL-CN.git
synced 2025-08-22 12:15:29 +08:00
修复纹理重复翻转
页面中的 C++ 示例代码包含了 stbi_set_flip_vertically_on_load(true);,这会在加载纹理时进行Y轴翻转。 然而,页面上展示的顶点着色器代码中,又进行了一次Y轴翻转:TexCoord = vec2(aTexCoord.x, 1.0 - aTexCoord.y);。 这两次翻转导致结果被抵消,最终渲染出的纹理仍然是上下颠倒的。
This commit is contained in:
@@ -445,7 +445,7 @@ uniform mat4 transform;
|
||||
void main()
|
||||
{
|
||||
gl_Position = transform * vec4(aPos, 1.0f);
|
||||
TexCoord = vec2(aTexCoord.x, 1.0 - aTexCoord.y);
|
||||
TexCoord = vec2(aTexCoord.x, aTexCoord.y);
|
||||
}
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user