diff options
author | Joshua Rahm <joshua.rahm@colorado.edu> | 2014-04-22 21:55:34 -0600 |
---|---|---|
committer | Joshua Rahm <joshua.rahm@colorado.edu> | 2014-04-22 21:55:34 -0600 |
commit | 4d62a6d631fb9703d818654c5b9722e747cfe190 (patch) | |
tree | 97104038db6cd8e3a13eb0e529975fd2edddc4ce /Graphics | |
parent | 14b6f5cee8236f7c42065813c5dd6a659d4d5d65 (diff) | |
download | terralloc-4d62a6d631fb9703d818654c5b9722e747cfe190.tar.gz terralloc-4d62a6d631fb9703d818654c5b9722e747cfe190.tar.bz2 terralloc-4d62a6d631fb9703d818654c5b9722e747cfe190.zip |
fixed most uniforms
Diffstat (limited to 'Graphics')
-rw-r--r-- | Graphics/Glyph/Shaders.hs | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/Graphics/Glyph/Shaders.hs b/Graphics/Glyph/Shaders.hs index 296e4a8..fa8712c 100644 --- a/Graphics/Glyph/Shaders.hs +++ b/Graphics/Glyph/Shaders.hs @@ -77,22 +77,13 @@ createShaderProgramSafe shaders = createShaderProgram $ workingShaders shaders -{- Get the uniform form a program. -} -getUniform :: Uniform a => String -> IO (Maybe (StateVar a)) -getUniform name = - get currentProgram >>= (\pr -> case pr of - Just p -> liftM (Just . uniform) (get $ uniformLocation p name) - Nothing -> return Nothing ) - -getUniformForProgram :: Uniform a => String -> Program -> IO (StateVar a) -getUniformForProgram name prog = - liftM uniform (get $ uniformLocation prog name) - - -getUniformLocation :: String -> IO (Maybe UniformLocation) -getUniformLocation name = - get currentProgram >>= maybe (return Nothing) (\prog -> - liftM Just (get $ uniformLocation prog name) ) +getUniformLocationsSafe :: Program -> [String] -> IO [ Maybe UniformLocation ] +getUniformLocationsSafe prog uniforms = + forM uniforms $ \uniform -> do + tmp <- get $ uniformLocation prog uniform + case tmp of + UniformLocation (-1) -> return $ Nothing + _ -> return $Just tmp loadProgramFullSafe :: (IsShaderSource tc, |