| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Graphics.GPipe.Context.GLFW
Contents
Description
Non interactive applications only need to pass configuration defined here
into GPipe's runContextT and newWindow.
Interactive applications will need Graphics.GPipe.Context.GLFW.Input.
- data Handle
- data GLFWWindow
- defaultHandleConfig :: ContextHandlerParameters Handle
- defaultWindowConfig :: String -> WindowConfig
- data family ContextHandlerParameters ctx :: *
- data WindowConfig = WindowConfig {}
- data EventPolicy
- data InitException = InitException
- data CreateWindowException
- data UnsafeWindowHintsException = UnsafeWindowHintsException [WindowHint]
- mainloop :: MonadIO m => Window os c ds -> EventPolicy -> ContextT Handle os m (Maybe ())
- mainstep :: MonadIO m => Window os c ds -> EventPolicy -> ContextT Handle os m (Maybe ())
- module Graphics.GPipe.Context.GLFW.Input
- module Graphics.GPipe.Context.GLFW.Window
- module Graphics.GPipe.Context.GLFW.Misc
GPipe context handler for GLFW
Opaque handle representing the initialized GLFW library.
To get started quickly try defaultHandleConfig and defaultWindowConfig.
import Graphics.GPipe
import qualified Graphics.GPipe.Context.GLFW as GLFW
runContextT GLFW.defaultHandleConfig $ do
win <- newWindow (WindowFormatColorDepth RGB8 Depth16) (GLFW.defaultWindowConfig "OpenGL Graphics")
-- Do GPipe things here
Instances
| ContextHandler Handle Source # | |
| type WindowParameters Handle Source # | |
| type ContextWindow Handle Source # | |
| data ContextHandlerParameters Handle Source # | |
data GLFWWindow Source #
Opaque handle representing a, possibly closed, internal Context. You'll
typically deal with GPipe's Window instead of this one.
Configuration
Default configs
defaultHandleConfig :: ContextHandlerParameters Handle Source #
Default GLFW handle configuration.
- Print any errors that GLFW emits.
- Automatically process GLFW events after every buffer swap.
defaultWindowConfig :: String -> WindowConfig Source #
Default window configuration for a small window on any monitor with the given title.
Custom configs
data family ContextHandlerParameters ctx :: * #
Implementation specific context handler parameters, eg error handling and event processing policies
Instances
Configuration for the GLFW handle.
HandleConfig- Constructor
configErrorCallback::Error-> String -> IO ()- Specify a callback to handle errors emitted by GLFW.
configEventPolicy:: MaybeEventPolicy- Specify the
EventPolicyto use for automatic GLFW event processing. IfNothingthen automatic event processing is disabled and you'll need to callmainloopormainstepsomewhere.
data WindowConfig Source #
Configuration for a new GLFW window and associated OpenGL context.
Constructors
| WindowConfig | |
Fields
| |
Instances
data EventPolicy Source #
Type to describe the waiting or polling style of event processing supported by GLFW.
- Recommended reading: Event Processing section of the GLFW Input Guide at http://www.glfw.org/docs/latest/input_guide.html#events.
Instances
Exceptions
data InitException Source #
IO exception thrown when GLFW library initialization fails.
Constructors
| InitException |
Instances
data CreateWindowException Source #
IO Exception thrown when GLFW window creation fails.
Constructors
| CreateWindowException String | |
| CreateSharedWindowException String |
data UnsafeWindowHintsException Source #
IO Exception thrown when attempting to create a new window using GLFW hints which GPipe manages.
Constructors
| UnsafeWindowHintsException [WindowHint] |
Mainthread hooks
Arguments
| :: MonadIO m | |
| => Window os c ds | |
| -> EventPolicy | A |
| -> ContextT Handle os m (Maybe ()) |
Process GLFW and GPipe events according to the given EventPolicy in a
loop.
Use case: Call mainloop in multithreaded applications which do GPipe
rendering off of the main thread, but which do not otherwise need additional
control over the main thread. For less complex applications use automatic
event processing configured via HandleConfig.
- Must be called on the main thread.
- The loop will run until
windowShouldCloseis true for the allWindows created by the sameContextHandler, or all theWindows have been deleted. - To indicate a window should close use
setWindowShouldClosein Graphics.GPipe.Context.GLFW.Wrapped.
Arguments
| :: MonadIO m | |
| => Window os c ds | |
| -> EventPolicy |
|
| -> ContextT Handle os m (Maybe ()) |
Process GLFW and GPipe events according to the given EventPolicy.
Use case: Call mainstep as part of a custom engine loop in multithreaded
applications which do GPipe rendering off of the main thread. Use mainloop
for less complex applications.
- Must be called on the main thread.
- Can be called with any window you've created and not yet deleted.
- If GPipe can't find the window you passed in, returns
Nothing.