From 4d62a6d631fb9703d818654c5b9722e747cfe190 Mon Sep 17 00:00:00 2001 From: Joshua Rahm Date: Tue, 22 Apr 2014 21:55:34 -0600 Subject: fixed most uniforms --- Graphics/Glyph/Shaders.hs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'Graphics/Glyph/Shaders.hs') 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, -- cgit