Tweak fullscreen texture shaders

This commit is contained in:
jgk
2021-05-01 15:03:17 +02:00
parent 7711738b3b
commit 30c09d3403
11 changed files with 89 additions and 30 deletions
+13 -3
View File
@@ -120,7 +120,17 @@ addTexture texturePath shad = do
textureFilter Texture2D $= ((Linear',Just Linear') , Nearest)
return $ shad & shaderTexture ?~ ShaderTexture {_textureObject = textureOb}
makeShader :: String -> [ShaderType] -> [(GLuint,Int)] -> PrimitiveMode -> (a -> [[[Float]]]) -> IO (FullShader a)
{- |
Compiles a full shader found within the shader directory.
The shader is made up of files begining with the inputted string with extensions .vert, .geom etc.
-}
makeShader
:: String -- ^ First part of the name of the shader
-> [ShaderType] -- ^ Filetype extensions
-> [(GLuint,Int)] -- ^ The shaders input vertices (location, size)
-> PrimitiveMode
-> (a -> [[[Float]]]) -- ^ Poke strategy: method for creating a list of vertex data to be bound
-> IO (FullShader a)
makeShader s shaderlist alocs pm renStrat = do
(prog,unis) <- makeSourcedShader s shaderlist
vao <- setupVAO alocs
@@ -170,9 +180,9 @@ setupArrayBuffer (aloc,i) = do
vertexAttribArray (AttribLocation aloc) $= Enabled
return vbo
-- compile shader and get its uniform locations
-- | Compile shader and get its uniform locations.
-- supposes the shader code is in the shader folder, with the string names
-- followed by .vert/.geom/.frag
-- followed by .vert/.geom/.frag.
makeSourcedShader :: String -> [ShaderType] -> IO (Program, [UniformLocation])
makeSourcedShader s sts = do
sources <- forM sts $ \st -> BS.readFile ("shader/" ++ s ++ shaderTypeExt st)