Unify matrix uniform assignment, move towards uniform block
This commit is contained in:
@@ -15,7 +15,7 @@ import Graphics.Rendering.OpenGL hiding (Point,translate,scale,imageHeight)
|
||||
|
||||
-- I am not sure if this assumes that the shader is constructed directly before
|
||||
-- the texture is added...
|
||||
addTexture :: String -> FullShader -> IO (FullShader)
|
||||
addTexture :: String -> FullShader -> IO FullShader
|
||||
addTexture texturePath shad = do
|
||||
Right cmap <- readImage texturePath
|
||||
let tex = convertRGBA8 cmap
|
||||
@@ -31,7 +31,7 @@ addTexture texturePath shad = do
|
||||
textureFilter Texture2D $= ((Linear',Just Linear') , Nearest)
|
||||
return $ shad & shaderTexture ?~ ShaderTexture {_textureObject = textureOb}
|
||||
|
||||
addTextureArray :: String -> FullShader -> IO (FullShader)
|
||||
addTextureArray :: String -> FullShader -> IO FullShader
|
||||
addTextureArray texturePath shad = do
|
||||
Right cmap <- readImage texturePath
|
||||
let tex = convertRGBA8 cmap
|
||||
@@ -56,7 +56,7 @@ tilesToLine
|
||||
-> [a]
|
||||
tilesToLine w n = concat . concat . transpose . chunksOf n . chunksOf w
|
||||
|
||||
addUniforms :: [String] -> FullShader -> IO (FullShader)
|
||||
addUniforms :: [String] -> FullShader -> IO FullShader
|
||||
addUniforms uniStrings shad = do
|
||||
uniLocs <- mapM (uniformLocation $ _shaderProgram shad) uniStrings
|
||||
return $ shad & shaderCustomUnis %~ (++ uniLocs)
|
||||
|
||||
@@ -23,7 +23,7 @@ makeShader
|
||||
-> [Int] -- ^ The input vertex sizes
|
||||
-> PrimitiveMode
|
||||
-> (RenderType -> [[Float]]) -- ^ Poke strategy: method for creating a list of vertex data to be bound
|
||||
-> IO (FullShader)
|
||||
-> IO FullShader
|
||||
makeShader s shaderlist sizes pm renStrat = do
|
||||
(prog,unis) <- makeSourcedShader s shaderlist
|
||||
vaob <- setupVAO sizes
|
||||
@@ -57,7 +57,7 @@ setupVAO :: [Int] -> IO VAO
|
||||
setupVAO sizes = do
|
||||
theVAO <- genObjectName
|
||||
bindVertexArrayObject $= Just theVAO
|
||||
theVBO <- setupVBO $ sizes
|
||||
theVBO <- setupVBO sizes
|
||||
return $ VAO
|
||||
{ _vao = theVAO
|
||||
, _vaoVBO = theVBO
|
||||
|
||||
Reference in New Issue
Block a user