dynamic-graph-0.1.0.13: Draw and update graphs in real time with OpenGL

Safe HaskellNone
LanguageHaskell2010

Graphics.DynamicGraph.Waterfall

Description

Draw and update waterfall plots with OpenGL. Useful for spectrograms.

Example usage:

import Control.Monad
import Control.Monad.Trans.Except
import Control.Error.Util
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 = exceptT putStrLn return $ do
    res <- lift setupGLFW
    unless res (throwE "Unable to initilize GLFW")

    waterfall <- window 1024 480 $ renderWaterfall 1000 1000 jet_mod

    lift $ runEffect $ randomVect >-> waterfall
Synopsis

Documentation

renderWaterfall Source #

Arguments

:: IsPixelData a 
=> Int

waterfall columns

-> Int

waterfall rows

-> [GLfloat]

waterfall color map

-> IO (Consumer a IO ()) 

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.