module Graphics.Rendering.Ombra.Draw (
Draw,
DrawState,
Ctx,
refDrawCtx,
runDrawCtx,
execDrawCtx,
evalDrawCtx,
drawState,
drawInit,
clearBuffers,
drawLayer,
resizeViewport,
preloadGeometry,
preloadTexture,
preloadProgram,
removeGeometry,
removeTexture,
removeProgram,
gl
) where
import Data.IORef
import Graphics.Rendering.Ombra.Draw.Internal
import Graphics.Rendering.Ombra.Internal.GL hiding (Buffer)
import Graphics.Rendering.Ombra.Layer
refDrawCtx :: GLES => Ctx -> Draw a -> IORef DrawState -> IO a
refDrawCtx ctx d ref = do state <- readIORef ref
(ret, state') <- runDrawCtx ctx d state
writeIORef ref state'
return ret
runDrawCtx :: Ctx
-> Draw a
-> DrawState
-> IO (a, DrawState)
runDrawCtx ctx d = flip evalGL ctx . runDraw d
execDrawCtx :: Ctx -> Draw a -> DrawState -> IO DrawState
execDrawCtx ctx d = flip evalGL ctx . execDraw d
evalDrawCtx :: Ctx -> Draw a -> DrawState -> IO a
evalDrawCtx ctx d = flip evalGL ctx . evalDraw d