flip image at loading, not in shader
This commit is contained in:
parent
3dab16259e
commit
58db022a7b
4 changed files with 9 additions and 6 deletions
|
@ -29,6 +29,7 @@ executable renderer-tutorial
|
||||||
, monad-loops
|
, monad-loops
|
||||||
, random
|
, random
|
||||||
, JuicyPixels
|
, JuicyPixels
|
||||||
|
, JuicyPixels-extra
|
||||||
other-modules: BindableClass
|
other-modules: BindableClass
|
||||||
, BufferClass
|
, BufferClass
|
||||||
, VertexBuffer
|
, VertexBuffer
|
||||||
|
|
|
@ -8,5 +8,5 @@ out vec2 v_texCoord;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = vec4(position, 1);
|
gl_Position = vec4(position, 1);
|
||||||
v_texCoord = vec2(texCoord.x, 1.0 - texCoord.y);
|
v_texCoord = texCoord;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,9 @@ let
|
||||||
|
|
||||||
inherit (nixpkgs) pkgs;
|
inherit (nixpkgs) pkgs;
|
||||||
|
|
||||||
f = { mkDerivation, base, bytestring, JuicyPixels, linear
|
f = { mkDerivation, base, bytestring, JuicyPixels
|
||||||
, monad-loops, OpenGL, OpenGLRaw, random, sdl2, stdenv, vector
|
, JuicyPixels-extra, linear, monad-loops, OpenGL, OpenGLRaw, random
|
||||||
|
, sdl2, stdenv, vector
|
||||||
}:
|
}:
|
||||||
mkDerivation {
|
mkDerivation {
|
||||||
pname = "renderer-tutorial";
|
pname = "renderer-tutorial";
|
||||||
|
@ -14,8 +15,8 @@ let
|
||||||
isLibrary = false;
|
isLibrary = false;
|
||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
executableHaskellDepends = [
|
executableHaskellDepends = [
|
||||||
base bytestring JuicyPixels linear monad-loops OpenGL OpenGLRaw
|
base bytestring JuicyPixels JuicyPixels-extra linear monad-loops
|
||||||
random sdl2 vector
|
OpenGL OpenGLRaw random sdl2 vector
|
||||||
];
|
];
|
||||||
license = stdenv.lib.licenses.gpl3;
|
license = stdenv.lib.licenses.gpl3;
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,6 +5,7 @@ import SDL (($=), get)
|
||||||
import qualified Graphics.Rendering.OpenGL as GL
|
import qualified Graphics.Rendering.OpenGL as GL
|
||||||
|
|
||||||
import Codec.Picture
|
import Codec.Picture
|
||||||
|
import Codec.Picture.Extra
|
||||||
|
|
||||||
import Data.Either
|
import Data.Either
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ newTexture :: FilePath -> GL.GLuint -> IO Texture
|
||||||
newTexture fp slot = do
|
newTexture fp slot = do
|
||||||
|
|
||||||
-- read in image from filesystem
|
-- read in image from filesystem
|
||||||
img <- convertRGBA8 <$>
|
img <- flipVertically <$> convertRGBA8 <$>
|
||||||
either (error $ "reading image file " <> fp <> " failed!") id <$>
|
either (error $ "reading image file " <> fp <> " failed!") id <$>
|
||||||
readImage fp
|
readImage fp
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue