Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
Synopsis
- data Handle
- data GLFWWindow
- defaultHandleConfig :: ContextHandlerParameters Handle
- defaultWindowConfig :: String -> WindowConfig
- data family ContextHandlerParameters ctx
- data WindowConfig = WindowConfig {}
- data WindowHint
- = WindowHint'Resizable !Bool
- | WindowHint'Visible !Bool
- | WindowHint'Decorated !Bool
- | WindowHint'RedBits !(Maybe Int)
- | WindowHint'GreenBits !(Maybe Int)
- | WindowHint'BlueBits !(Maybe Int)
- | WindowHint'AlphaBits !(Maybe Int)
- | WindowHint'DepthBits !(Maybe Int)
- | WindowHint'StencilBits !(Maybe Int)
- | WindowHint'AccumRedBits !(Maybe Int)
- | WindowHint'AccumGreenBits !(Maybe Int)
- | WindowHint'AccumBlueBits !(Maybe Int)
- | WindowHint'AccumAlphaBits !(Maybe Int)
- | WindowHint'AuxBuffers !(Maybe Int)
- | WindowHint'Samples !(Maybe Int)
- | WindowHint'RefreshRate !(Maybe Int)
- | WindowHint'DoubleBuffer !Bool
- | WindowHint'Stereo !Bool
- | WindowHint'sRGBCapable !Bool
- | WindowHint'Floating !Bool
- | WindowHint'Focused !Bool
- | WindowHint'Maximized !Bool
- | WindowHint'AutoIconify !Bool
- | WindowHint'ClientAPI !ClientAPI
- | WindowHint'ContextCreationAPI !ContextCreationAPI
- | WindowHint'ContextVersionMajor !Int
- | WindowHint'ContextVersionMinor !Int
- | WindowHint'ContextRobustness !ContextRobustness
- | WindowHint'ContextReleaseBehavior !ContextReleaseBehavior
- | WindowHint'ContextNoError !Bool
- | WindowHint'OpenGLForwardCompat !Bool
- | WindowHint'OpenGLDebugContext !Bool
- | WindowHint'OpenGLProfile !OpenGLProfile
- | WindowHint'TransparentFramebuffer !Bool
- | WindowHint'CenterCursor !Bool
- | WindowHint'FocusOnShow !Bool
- | WindowHint'ScaleToMonitor !Bool
- | WindowHint'CocoaRetinaFramebuffer !Bool
- | WindowHint'CocoaGraphicsSwitching !Bool
- | WindowHint'CocoaFrameName !String
- | WindowHint'X11ClassName !String
- | WindowHint'X11InstanceName !String
- data EventPolicy
- = Poll
- | Wait
- | WaitTimeout Double
- data InitException = InitException
- data CreateWindowException
- newtype 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 # | |
Defined in Graphics.GPipe.Context.GLFW.Handler contextHandlerCreate :: ContextHandlerParameters Handle -> IO Handle # contextHandlerDelete :: Handle -> IO () # createContext :: Handle -> Maybe (WindowBits, WindowParameters Handle) -> IO (ContextWindow Handle) # contextDoAsync :: Handle -> Maybe (ContextWindow Handle) -> IO () -> IO () # contextSwap :: Handle -> ContextWindow Handle -> IO () # contextFrameBufferSize :: Handle -> ContextWindow Handle -> IO (Int, Int) # contextDelete :: Handle -> ContextWindow Handle -> IO () # | |
type WindowParameters Handle Source # | |
Defined in Graphics.GPipe.Context.GLFW.Handler | |
type ContextWindow Handle Source # | |
Defined in Graphics.GPipe.Context.GLFW.Handler | |
data ContextHandlerParameters Handle Source # | |
Defined in Graphics.GPipe.Context.GLFW.Handler data ContextHandlerParameters Handle = HandleConfig {
|
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.
- Log only context handling activity which represents undesired conditions.
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
data ContextHandlerParameters Handle Source # | |
Defined in Graphics.GPipe.Context.GLFW.Handler data ContextHandlerParameters Handle = HandleConfig {
|
Configuration for the GLFW handle.
HandleConfig
- Constructor
configErrorCallback
::Error
-> String -> IO ()- Specify a callback to handle errors emitted by GLFW.
configEventPolicy
:: MaybeEventPolicy
- Specify the
EventPolicy
to use for automatic GLFW event processing. IfNothing
then automatic event processing is disabled and you'll need to callmainloop
ormainstep
somewhere.
data WindowConfig Source #
Configuration for a new GLFW window and associated OpenGL context.
WindowConfig | |
|
Instances
Show WindowConfig Source # | |
Defined in Graphics.GPipe.Context.GLFW.Resource showsPrec :: Int -> WindowConfig -> ShowS # show :: WindowConfig -> String # showList :: [WindowConfig] -> ShowS # |
data WindowHint #
Lets you set various window hints before creating a Window
.
See Window Hints,
particularly Supported and Default Values.
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
Show EventPolicy Source # | |
Defined in Graphics.GPipe.Context.GLFW.Handler showsPrec :: Int -> EventPolicy -> ShowS # show :: EventPolicy -> String # showList :: [EventPolicy] -> ShowS # |
Exceptions
data InitException Source #
IO exception thrown when GLFW library initialization fails.
Instances
Show InitException Source # | |
Defined in Graphics.GPipe.Context.GLFW.Handler showsPrec :: Int -> InitException -> ShowS # show :: InitException -> String # showList :: [InitException] -> ShowS # | |
Exception InitException Source # | |
Defined in Graphics.GPipe.Context.GLFW.Handler |
data CreateWindowException Source #
IO Exception thrown when GLFW window creation fails.
Instances
Show CreateWindowException Source # | |
Defined in Graphics.GPipe.Context.GLFW.Handler showsPrec :: Int -> CreateWindowException -> ShowS # show :: CreateWindowException -> String # showList :: [CreateWindowException] -> ShowS # | |
Exception CreateWindowException Source # | |
newtype UnsafeWindowHintsException Source #
IO Exception thrown when attempting to create a new window using GLFW hints which GPipe manages.
Instances
Mainthread hooks
:: 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
windowShouldClose
is true for the allWindow
s created by the sameContextHandler
, or all theWindow
s have been deleted. - To indicate a window should close use
setWindowShouldClose
in Graphics.GPipe.Context.GLFW.Wrapped.
:: 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
.