-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Draw and update graphs in real time with OpenGL -- -- Draw and update graphs in real time with OpenGL. Suitable for -- displaying large amounts of frequently changing data. Line graphs and -- waterfall plots are supported, as well as axis drawing. -- -- See https://github.com/adamwalker/dynamic-graph for examples of -- the graphs it can produce. -- -- To get started, see Graphics.DynamicGraph.Window @package dynamic-graph @version 0.1.0.7 -- | Various utilities for drawing axes with Cairo that will later be -- rendered using Graphics.DynamicGraph.RenderCairo module Graphics.DynamicGraph.Axis -- | Create a blank cairo canvas of the specified size and colour blankCanvas :: Colour Double -> Double -> Double -> Render () -- | Create a blank cairo canvas of the specified size and colour blankCanvasAlpha :: Colour Double -> Double -> Double -> Double -> Render () -- | Draw a set of axes without any labels drawAxes :: Double -> Double -> Double -> Double -> Double -> Double -> Colour Double -> Double -> Render () -- | Calculate the coordinates to draw the X axis grid at gridXCoords :: Double -> Double -> Double -> Double -> Double -> [Double] -- | Calculate the coordinates to draw the Y axis grid at gridYCoords :: Double -> Double -> Double -> Double -> Double -> [Double] -- | Draw X axis labels xAxisLabels :: PangoContext -> Colour Double -> [String] -> [Double] -> Double -> Render () -- | Draw Y axis labels yAxisLabels :: PangoContext -> Colour Double -> [String] -> [Double] -> Double -> Render () -- | Draw X axis grid xAxisGrid :: Colour Double -> Double -> [Double] -> Double -> Double -> [Double] -> Render () -- | Draw Y axis grid yAxisGrid :: Colour Double -> Double -> [Double] -> Double -> Double -> [Double] -> Render () -- | Various utility functions module Graphics.DynamicGraph.Util -- | Utility function to setup GLFW for graph drawing. Returns True on -- success. setupGLFW :: IO Bool -- | Returns True if texture units are accessible from the vertex shader. -- Needed by Graphics.DynamicGraph.Line. checkVertexTextureUnits :: IO Bool -- | tryTakeMVar then putMVar replaceMVar :: MVar a -> a -> IO () -- | Convert a function that performs a monadic action to a Consumer pipeify :: Monad m => (a -> m ()) -> Consumer a m () -- | A convenience function for rendering any of the graphs implemented in -- this package to a standalone window. -- -- Example usage: -- --
-- import Control.Monad -- import Control.Monad.Trans.Either -- import Control.Concurrent -- import Pipes -- import qualified Pipes.Prelude as P -- import System.Random -- import Graphics.Rendering.OpenGL -- -- import Graphics.DynamicGraph.Waterfall -- import Graphics.DynamicGraph.Window -- -- randomVect :: Producer [GLfloat] IO () -- randomVect = P.repeatM $ do -- res <- replicateM 1000 randomIO -- threadDelay 10000 -- return res -- -- main = eitherT putStrLn return $ do -- setupGLFW -- waterfall <- window 1024 480 $ renderWaterfall 1000 1000 jet_mod -- -- lift $ runEffect $ randomVect >-> waterfall --module Graphics.DynamicGraph.Window -- | A convenience function for rendering any of the graphs implemented in -- this package to a standalone window. -- -- Creates the window before returning. -- -- Returns either an error message or a consumer that draws to the -- window. window :: IsPixelData a => Int -> Int -> IO (Consumer a IO ()) -> EitherT String IO (Consumer a IO ()) -- | Various color maps. module Graphics.DynamicGraph.ColorMaps -- | The matlab / octave "jet" color map jet :: [GLfloat] -- | "jet" modified so that low values are a darker blue jet_mod :: [GLfloat] -- | The matlab / octave "hot" color map hot :: [GLfloat] -- | Ranges from black to white bw :: [GLfloat] -- | Ranges from white to black wb :: [GLfloat] -- | Draw and update waterfall plots with OpenGL. Useful for spectrograms. -- -- Example usage: -- --
-- import Control.Monad -- import Control.Monad.Trans.Either -- import Control.Concurrent -- import Pipes -- import qualified Pipes.Prelude as P -- import System.Random -- import Graphics.Rendering.OpenGL -- -- import Graphics.DynamicGraph.Waterfall -- import Graphics.DynamicGraph.Window -- -- randomVect :: Producer [GLfloat] IO () -- randomVect = P.repeatM $ do -- res <- replicateM 1000 randomIO -- threadDelay 10000 -- return res -- -- main = eitherT putStrLn return $ do -- setupGLFW -- waterfall <- window 1024 480 $ renderWaterfall 1000 1000 jet_mod -- -- lift $ runEffect $ randomVect >-> waterfall --module Graphics.DynamicGraph.Waterfall -- | Returns a Consumer that renders a waterfall plot into the -- current OpenGL context. -- -- All OpenGL based initialization of the rendering function (loading of -- shaders, etc) is performed before the Consumer is returned. -- -- This function must be called with an OpenGL context currently set. renderWaterfall :: IsPixelData a => Int -> Int -> [GLfloat] -> IO (Consumer a IO ()) -- | Draw and update filled in line graphs with OpenGL. -- -- Example usage: -- --
-- import Control.Monad -- import Control.Monad.Trans.Either -- import Control.Concurrent -- import Control.Applicative -- import Pipes -- import qualified Pipes.Prelude as P -- import System.Random -- import Graphics.Rendering.OpenGL -- -- import Graphics.DynamicGraph.FillLine -- import Graphics.DynamicGraph.Window -- -- randomVect :: Producer [GLfloat] IO () -- randomVect = P.repeatM $ do -- res <- replicateM 1000 randomIO -- threadDelay 10000 -- return res -- -- main = eitherT putStrLn return $ do -- setupGLFW -- lineGraph <- window 1024 480 $ pipeify <$> renderFilledLine 1000 jet_mod -- -- lift $ runEffect $ randomVect >-> lineGraph --module Graphics.DynamicGraph.FillLine -- | Returns a function that renders a filled in line graph into the -- current OpenGL context. -- -- All OpenGL based initialization of the rendering function (loading of -- shaders, etc) is performed before the function is returned. -- -- This function must be called with an OpenGL context currently set. renderFilledLine :: IsPixelData a => Int -> [GLfloat] -> IO (a -> IO ()) -- | Render Cairo drawings with OpenGL. Useful for drawing axes. module Graphics.DynamicGraph.RenderCairo -- | Returns a function that renders a cairo drawing into the current -- OpenGL context. -- -- All OpenGL based initialization of the rendering function (loading of -- shaders, rendering the cairo drawing to a texture, etc) is performed -- before the function is returned. -- -- This function must be called with an OpenGL context currently set. renderCairo :: Render a -> Int -> Int -> IO (IO ()) -- | Draw and update line graphs with OpenGL. -- -- Based on: -- https://en.wikibooks.org/wiki/OpenGL_Programming/Scientific_OpenGL_Tutorial_02 -- -- Example usage: -- --
-- import Control.Monad -- import Control.Monad.Trans.Either -- import Control.Concurrent -- import Control.Applicative -- import Pipes -- import qualified Pipes.Prelude as P -- import System.Random -- import Graphics.Rendering.OpenGL -- -- import Graphics.DynamicGraph.Line -- import Graphics.DynamicGraph.Window -- -- randomVect :: Producer [GLfloat] IO () -- randomVect = P.repeatM $ do -- res <- replicateM 1000 randomIO -- threadDelay 10000 -- return res -- -- main = eitherT putStrLn return $ do -- setupGLFW -- lineGraph <- window 1024 480 $ pipeify <$> renderLine 1000 1024 -- -- lift $ runEffect $ randomVect >-> lineGraph --module Graphics.DynamicGraph.Line -- | Returns a function that renders a line graph into the current OpenGL -- context. -- -- All OpenGL based initialization of the rendering function (loading of -- shaders, etc) is performed before the function is returned. -- -- This function must be called with an OpenGL context currently set. renderLine :: IsPixelData a => Int -> Int -> IO (a -> IO ())