module Graphics.DynamicGraph.Util (
setupGLFW,
checkVertexTextureUnits,
replaceMVar,
pipeify
) where
import Control.Monad
import Control.Monad.Trans.Class
import Control.Concurrent.MVar
import Control.Applicative
import Graphics.Rendering.OpenGL
import Graphics.UI.GLFW as G
import Pipes
setupGLFW :: IO Bool
setupGLFW = do
setErrorCallback $ Just $ \error msg -> do
print error
putStrLn msg
G.init
checkVertexTextureUnits :: IO Bool
checkVertexTextureUnits = (> 0) <$> get maxVertexTextureImageUnits
replaceMVar :: MVar a -> a -> IO ()
replaceMVar mv val = do
tryTakeMVar mv
putMVar mv val
pipeify :: Monad m => (a -> m ()) -> Consumer a m ()
pipeify = for cat . (lift .)