opengles-0.8.3: Functional interface for OpenGL 4.1+ and OpenGL ES 2.0+

Safe HaskellNone
LanguageHaskell2010

Graphics.OpenGLES.Sync

Synopsis

Documentation

data Sync Source

Constructors

Sync Word64 (IORef GLsync) 

getSync :: Maybe Word64 -> IO Sync Source

Obtain new Sync with or without timeout in nanoseconds. Fence sync objects are used to wait for partial completion of the GL command stream, as a more flexible form of glFinish.

-- Sync objects can be used many times
sync1 <- getSync (Just 16000)
sync2 <- getSync Nothing

For each frame:

glFence sync1 $ \isTimedOut -> do
  {- modify buffers, textures, etc -}
glFence sync2 $ \isTimedOut -> do
  {- modify buffers, textures, etc -}
endFrameGL

glFence :: Sync -> (Bool -> GL a) -> GL a Source

Block and wait for GPU commands issued here complete. Better glFinish for ES 3+. Block and wait for a Sync object to become signaled, then run specified block.

glFenceInGpu :: Sync -> GL a -> GL a Source

Blocks on GPU until GL commands issued here complete. Better glFlush for ES 3+. Sync timeout is ignored. Instruct the GL server to block (on the GPU) until the previous call of glFence* with specified Sync object becomes finished on the GL server, then run specified block.

glFlushCommandQ :: GL () Source

Same as glFlush. This operation is expensive, so frequent use should be avoided as far as possible.

glWaitComplete :: GL () Source

Same as glFinish. This operation is expensive, so frequent use should be avoided as far as possible.