Safe Haskell | None |
---|---|
Language | Haskell2010 |
Draw and update filled in line graphs with OpenGL.
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.FillLine randomVect :: Producer [GLfloat] IO () randomVect = P.repeatM $ do res <- replicateM 1000 randomIO threadDelay 10000 return res main = eitherT putStrLn return $ do setupGLFW lineGraph <- filledLineWindow 1024 480 1000 jet_mod lift $ runEffect $ randomVect >-> lineGraph
- filledLineWindow :: IsPixelData a => Int -> Int -> Int -> [GLfloat] -> EitherT String IO (Consumer a IO ())
- renderFilledLine :: IsPixelData a => Int -> [GLfloat] -> IO (a -> IO ())
- setupGLFW :: EitherT String IO ()
- module Graphics.DynamicGraph.ColorMaps
Documentation
filledLineWindow :: IsPixelData a => Int -> Int -> Int -> [GLfloat] -> EitherT String IO (Consumer a IO ()) Source
(filledLineWindow windowWidth windowHeight samples colorMap)
creates
a window of width windowWidth
and height windowHeight
for
displaying a line graph.
A function is returned for dynamically updating the line graph. It
takes an instance of IsPixelData of length samples
as the y values.
The fill is drawn with a vertical gradient defined by colorMap
.
renderFilledLine :: IsPixelData a => Int -> [GLfloat] -> IO (a -> IO ()) Source
(renderFilledLine samples colorMap)
returns a function that
renders a filled in line graph into the current OpenGL context. The
function takes an instance of IsPixelData of length samples
.
The fill is drawn with a vertical gradient defined by colorMap
.
All OpenGL based initialization of the rendering function (loading of shaders, etc) is performed before the function is returned.