FIX: Consistent y flipping of texture coords

This commit is contained in:
sebastian 2026-02-15 10:08:02 +01:00
parent 66020b9b9a
commit b3ad023729
4 changed files with 6 additions and 6 deletions

View File

@ -8,5 +8,5 @@ uniform mat4 transformationMatrix;
void main(void) {
gl_Position = transformationMatrix * vec4(position, 0.0, 1.0);
textureCoords = vec2((position.x + 1.0)/ 2.0, 1 - (position.y + 1.0)/2.0);
textureCoords = vec2((position.x + 1.0)/ 2.0, (position.y + 1.0)/2.0);
}

View File

@ -82,7 +82,7 @@ void MinimapRenderer::prepareShader() {
top = mapHeight * 0.5f * zoom;
}
glm::mat4 view = glm::lookAt(mapCenter + glm::vec3(0,50,0), mapCenter, glm::vec3(0,0,1));
glm::mat4 view = glm::lookAt(mapCenter + glm::vec3(0,50,0), mapCenter, glm::vec3(0,0,-1));
glm::mat4 proj = glm::ortho(left, right, bottom, top, -100.f, 100.f);
minimapShader.loadViewProjectionMatrix(proj * view);

View File

@ -20,10 +20,10 @@ WorldSpriteRenderer::WorldSpriteRenderer(const glm::mat4& projectionMatrix) : pr
};
std::vector<float> uvs = {
0.0f, 0.0f,
0.0f, 1.0f,
1.0f, 0.0f,
1.0f, 1.0f
0.0f, 0.0f,
1.0f, 1.0f,
1.0f, 0.0f
};
std::vector<int> indices = {

View File

@ -12,7 +12,7 @@
Texture2D TextureLoader::loadTexture(const std::string &path) {
Texture2D texture;
stbi_set_flip_vertically_on_load(false);
stbi_set_flip_vertically_on_load(true);
texture.pixels = stbi_load(
path.c_str(),