diff --git a/renderer-tutorial.cabal b/renderer-tutorial.cabal index 3819f8d..e245746 100644 --- a/renderer-tutorial.cabal +++ b/renderer-tutorial.cabal @@ -29,6 +29,7 @@ executable renderer-tutorial , monad-loops , random , JuicyPixels + , JuicyPixels-extra other-modules: BindableClass , BufferClass , VertexBuffer diff --git a/res/shaders/vert.shader b/res/shaders/vert.shader index ce230db..c053d6d 100644 --- a/res/shaders/vert.shader +++ b/res/shaders/vert.shader @@ -8,5 +8,5 @@ out vec2 v_texCoord; void main() { gl_Position = vec4(position, 1); - v_texCoord = vec2(texCoord.x, 1.0 - texCoord.y); + v_texCoord = texCoord; } diff --git a/shell.nix b/shell.nix index 00a8488..040059e 100644 --- a/shell.nix +++ b/shell.nix @@ -4,8 +4,9 @@ let inherit (nixpkgs) pkgs; - f = { mkDerivation, base, bytestring, JuicyPixels, linear - , monad-loops, OpenGL, OpenGLRaw, random, sdl2, stdenv, vector + f = { mkDerivation, base, bytestring, JuicyPixels + , JuicyPixels-extra, linear, monad-loops, OpenGL, OpenGLRaw, random + , sdl2, stdenv, vector }: mkDerivation { pname = "renderer-tutorial"; @@ -14,8 +15,8 @@ let isLibrary = false; isExecutable = true; executableHaskellDepends = [ - base bytestring JuicyPixels linear monad-loops OpenGL OpenGLRaw - random sdl2 vector + base bytestring JuicyPixels JuicyPixels-extra linear monad-loops + OpenGL OpenGLRaw random sdl2 vector ]; license = stdenv.lib.licenses.gpl3; }; diff --git a/src/Texture.hs b/src/Texture.hs index 49fd0d3..6df81ae 100644 --- a/src/Texture.hs +++ b/src/Texture.hs @@ -5,6 +5,7 @@ import SDL (($=), get) import qualified Graphics.Rendering.OpenGL as GL import Codec.Picture +import Codec.Picture.Extra import Data.Either @@ -40,7 +41,7 @@ newTexture :: FilePath -> GL.GLuint -> IO Texture newTexture fp slot = do -- read in image from filesystem - img <- convertRGBA8 <$> + img <- flipVertically <$> convertRGBA8 <$> either (error $ "reading image file " <> fp <> " failed!") id <$> readImage fp