Safe Haskell | None |
---|---|
Language | Haskell2010 |
The main module. You should also import a backend:
- FWGL.Backend.JavaScript: GHCJS/WebGL backend (contained in fwgl-javascript)
- FWGL.Backend.GLFW.GL20: GLFW/OpenGL 2.0 backend (contained in fwgl-glfw)
And a graphics system:
- FWGL.Graphics.D2: 2D graphics
- FWGL.Graphics.D3: 3D graphics
- FWGL.Graphics.Generic
FWGL.Shader contains the EDSL to make custom shaders.
Import FWGL.Internal.GL if you want to use the raw GL commands.
- module FWGL.Input
- module FRP.Yampa
- newtype FWGL a = FWGL (ReaderT BackendState IO a)
- fwgl :: BackendIO => FWGL () -> IO ()
- mapIO :: (IO a -> IO b) -> FWGL a -> FWGL b
- data Output
- run :: BackendIO => SF (Input ()) Output -> FWGL ()
- run' :: BackendIO => IO inp -> SF (Input inp) Output -> FWGL ()
- runTo :: BackendIO => String -> IO inp -> SF (Input inp) Output -> FWGL ()
- draw :: BackendIO => [Layer] -> Output
- loadOBJ :: BackendIO => FilePath -> IO (Either String (Geometry Geometry3D))
- loadOBJAsync :: BackendIO => FilePath -> (Either String (Geometry Geometry3D) -> IO ()) -> IO ()
- loadTextFileAsync :: BackendIO => FilePath -> (Either String String -> IO ()) -> IO ()
- data Effect a
- eff :: Effect () -> Output
- drawEff :: BackendIO => [Layer] -> Effect () -> Output
- drawMEff :: Draw a -> (a -> Effect ()) -> Output
- fastStep :: Effect () -> Output
- liftIO :: MonadIO m => forall a. IO a -> m a
- liftDraw :: Draw a -> Effect a
- setSize :: BackendIO => Int -> Int -> Effect ()
- setTitle :: BackendIO => String -> Effect ()
- data Draw a
- drawM :: Draw () -> Output
- drawLayer :: (GLES, BackendIO) => Layer -> Draw ()
- drawGroup :: (GLES, BackendIO) => Group gs is -> Draw ()
- drawObject :: (GLES, BackendIO) => Object gs is -> Draw ()
- setProgram :: (GLES, BackendIO) => Program g i -> Draw ()
- renderLayer :: BackendIO => RenderLayer a -> Draw (a, [Texture])
- resizeViewport :: GLES => Int -> Int -> Draw ()
- gl :: GL a -> Draw a
- textureUniform :: (GLES, BackendIO) => Texture -> Draw ActiveTexture
- textureSize :: (GLES, BackendIO, Num a) => Texture -> Draw (a, a)
- removeGeometry :: (GLES, BackendIO) => Geometry is -> Draw Bool
- removeTexture :: BackendIO => Texture -> Draw Bool
- removeProgram :: (GLES, BackendIO) => Program gs is -> Draw Bool
- runIO :: BackendIO => (Double -> Input () -> IO Output) -> FWGL ()
- runToIO :: BackendIO => String -> (Int -> Int -> IO ()) -> (Double -> Input () -> IO Output) -> FWGL ()
Documentation
module FWGL.Input
module FRP.Yampa
FWGL (ReaderT BackendState IO a) |
fwgl :: BackendIO => FWGL () -> IO () Source
Initialize the FWGL backend, run the action and terminate it.
FRP interface
Run a FWGL program on a new canvas/window.
Run a FWGL program, using custom inputs.
:: BackendIO | |
=> String | Destination canvas (eg. "#myCanvasId"). This has meaning only in the JavaScript backend. |
-> IO inp | An IO effect generating the custom inputs. |
-> SF (Input inp) Output | |
-> FWGL () |
Run a FWGL program, using custom inputs and a specified canvas.
File loading
loadOBJ :: BackendIO => FilePath -> IO (Either String (Geometry Geometry3D)) Source
Load a model from an OBJ file.
:: BackendIO | |
=> FilePath | Path or URL. |
-> (Either String (Geometry Geometry3D) -> IO ()) | Callback. |
-> IO () |
Load a model from an OBJ file asynchronously.
Load a file asynchronously.
Effect monad
drawEff :: BackendIO => [Layer] -> Effect () -> Output Source
Draw some layers and perform an effect.
fastStep :: Effect () -> Output Source
Use this instead of eff
when you want the next sample to be performed
immediately (e.g. when you need to produce some computationally expensive
effectful input at the request of the signal function).
Lifting functions
Window/Canvas
Draw monad (for advanced use)
Drawing
renderLayer :: BackendIO => RenderLayer a -> Draw (a, [Texture]) Source
Realize a RenderLayer
. It returns the list of allocated Texture
s so
that you can free them if you want.
Texture functions
textureUniform :: (GLES, BackendIO) => Texture -> Draw ActiveTexture Source
This helps you set the uniforms of type Sampler2D
.
textureSize :: (GLES, BackendIO, Num a) => Texture -> Draw (a, a) Source
Get the dimensions of a Texture
.
Resources
removeGeometry :: (GLES, BackendIO) => Geometry is -> Draw Bool Source
Delete a Geometry
from the GPU.
removeProgram :: (GLES, BackendIO) => Program gs is -> Draw Bool Source
Delete a Program
from the GPU.
IO interface
Run a non-reactive FWGL program.