From 140e67036c3beef4fb85e27f20e24c4f0471d195 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 3 May 2015 17:10:50 +0200 Subject: [PATCH] Flip non-dds textures vertically Fixes the up-side down loading screens. --- components/resource/texturemanager.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/resource/texturemanager.cpp b/components/resource/texturemanager.cpp index 939f81d9b8..ee75296a79 100644 --- a/components/resource/texturemanager.cpp +++ b/components/resource/texturemanager.cpp @@ -92,6 +92,15 @@ namespace Resource } osg::Image* image = result.getImage(); + + // We need to flip images, because the Morrowind texture coordinates use the DirectX convention (top-left image origin), + // but OpenGL uses bottom left as the image origin. + // For some reason this doesn't concern DDS textures, which are already flipped when loaded. + if (ext != "dds") + { + image->flipVertical(); + } + osg::ref_ptr texture(new osg::Texture2D); texture->setImage(image); texture->setWrap(osg::Texture::WRAP_S, wrapS);