-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A binding for the OpenGL Utility Toolkit -- -- A Haskell binding for the OpenGL Utility Toolkit, a window system -- independent toolkit for writing OpenGL programs. For more information -- about the C library on which this binding is based, please see: -- http://www.opengl.org/resources/libraries/glut/. @package GLUT @version 2.7.0.12 -- | GLUT supports two types of windows: top-level windows and subwindows. -- Both types support OpenGL rendering and GLUT callbacks. There is a -- single identifier space for both types of windows. module Graphics.UI.GLUT.Window -- | An opaque identifier for a top-level window or a subwindow. data Window -- | Create a top-level window. The given name will be provided to the -- window system as the window's name. The intent is that the window -- system will label the window with the name.Implicitly, the current -- window is set to the newly created window. -- -- X Implementation Notes: The proper X Inter-Client Communication -- Conventions Manual (ICCCM) top-level properties are established. The -- WM_COMMAND property that lists the command line used to -- invoke the GLUT program is only established for the first window -- created. createWindow :: MonadIO m => String -> m Window -- | Create a subwindow of the identified window with the given relative -- position and size. Implicitly, the current window is set to the -- newly created subwindow. Subwindows can be nested arbitrarily deep. createSubWindow :: MonadIO m => Window -> Position -> Size -> m Window -- | Destroy the specified window and the window's associated OpenGL -- context, logical colormap (if the window is color index), and overlay -- and related state (if an overlay has been established). Any subwindows -- of the destroyed window are also destroyed by destroyWindow. If -- the specified window was the current window, the current -- window becomes invalid (currentWindow will contain -- Nothing). destroyWindow :: MonadIO m => Window -> m () -- | Contains the current window's parent. If the current -- window is a top-level window, Nothing is returned. parentWindow :: GettableStateVar (Maybe Window) -- | Contains the number of subwindows the current window has, not -- counting children of children. numSubWindows :: GettableStateVar Int -- | Controls the current window. It does not affect the -- layer in use for the window; this is done using -- layerInUse. Contains Nothing if no windows exist or the -- previously current window was destroyed. Setting the current -- window to Nothing is a no-op. currentWindow :: StateVar (Maybe Window) -- | Mark the normal plane of given window (or the current window, -- if none is supplied) as needing to be redisplayed. The next iteration -- through mainLoop, the window's display callback will be called -- to redisplay the window's normal plane. Multiple calls to -- postRedisplay before the next display callback opportunity -- generates only a single redisplay callback. postRedisplay may -- be called within a window's display or overlay display callback to -- re-mark that window for redisplay. -- -- Logically, normal plane damage notification for a window is treated as -- a postRedisplay on the damaged window. Unlike damage reported -- by the window system, postRedisplay will not set to true -- the normal plane's damaged status (see damaged). -- -- Also, see postOverlayRedisplay. postRedisplay :: MonadIO m => Maybe Window -> m () -- | Mark the normal plane of the given window as needing to be -- redisplayed, otherwise the same as postRedisplay. -- -- The advantage of this routine is that it saves the cost of using -- currentWindow (entailing an expensive OpenGL context switch), -- which is particularly useful when multiple windows need redisplays -- posted at the same time. -- -- Perform a buffer swap on the layer in use for the current -- window. Specifically, swapBuffers promotes the contents of -- the back buffer of the layer in use of the current -- window to become the contents of the front buffer. The contents of -- the back buffer then become undefined. The update typically takes -- place during the vertical retrace of the monitor, rather than -- immediately after swapBuffers is called. -- -- An implicit flush is done by swapBuffers before it -- returns. Subsequent OpenGL commands can be issued immediately after -- calling swapBuffers, but are not executed until the buffer -- exchange is completed. -- -- If the layer in use is not double buffered, swapBuffers -- has no effect. swapBuffers :: MonadIO m => m () -- | Controls the position of the current window. For top-level -- windows, parameters of Position are pixel offsets from the -- screen origin. For subwindows, the parameters are pixel offsets from -- the window's parent window origin. -- -- In the case of top-level windows, setting windowPosition is -- considered only a request for positioning the window. The window -- system is free to apply its own policies to top-level window -- placement. The intent is that top-level windows should be repositioned -- according to the value of windowPosition. windowPosition :: StateVar Position -- | Controls the size of the current window. The parameters of -- Size are size extents in pixels. The width and height must be -- positive values. -- -- In the case of top-level windows, setting windowSize is -- considered only a request for sizing the window. The window system is -- free to apply its own policies to top-level window sizing. The intent -- is that top-level windows should be reshaped according to the value of -- windowSize. Whether a reshape actually takes effect and, if so, -- the reshaped dimensions are reported to the program by a reshape -- callback. windowSize :: StateVar Size -- | Request that the current window be made full screen. The exact -- semantics of what full screen means may vary by window system. The -- intent is to make the window as large as possible and disable any -- window decorations or borders added the window system. The window -- width and height are not guaranteed to be the same as the screen width -- and height, but that is the intent of making a window full screen. -- -- fullScreen is defined to work only on top-level windows. -- -- X Implementation Notes: In the X implementation of GLUT, full -- screen is implemented by sizing and positioning the window to cover -- the entire screen and posting the _MOTIF_WM_HINTS property on -- the window requesting absolutely no decorations. Non-Motif window -- managers may not respond to _MOTIF_WM_HINTS. fullScreen :: MonadIO m => m () -- | (freeglut only) Toggle between windowed and full screen mode. fullScreenToggle :: MonadIO m => m () -- | (freeglut only) If we are in full screen mode, resize the -- current window back to its original size. leaveFullScreen :: MonadIO m => m () -- | Change the stacking order of the current window relative to its -- siblings (lowering it). pushWindow :: MonadIO m => m () -- | Change the stacking order of the current window relative to its -- siblings, bringing the current window closer to the top. popWindow :: MonadIO m => m () -- | The display status of a window. data WindowStatus Shown :: WindowStatus Hidden :: WindowStatus Iconified :: WindowStatus -- | Controls the display status of the current window. -- -- Note that the effect of showing, hiding, and iconifying windows does -- not take place immediately. Instead the requests are saved for -- execution upon return to the GLUT event loop. Subsequent show, hide, -- or iconification requests on a window replace the previously saved -- request for that window. The effect of hiding, showing, or iconifying -- top-level windows is subject to the window system's policy for -- displaying windows. Subwindows can't be iconified. windowStatus :: SettableStateVar WindowStatus -- | Controls the window title of the current top-level window. windowTitle :: SettableStateVar String -- | Controls the icon title of the current top-level window. iconTitle :: SettableStateVar String -- | The different cursor images GLUT supports. data Cursor -- | Arrow pointing up and to the right. RightArrow :: Cursor -- | Arrow pointing up and to the left. LeftArrow :: Cursor -- | Pointing hand. Info :: Cursor -- | Skull & cross bones. Destroy :: Cursor -- | Question mark. Help :: Cursor -- | Arrows rotating in a circle. Cycle :: Cursor -- | Spray can. Spray :: Cursor -- | Wrist watch. Wait :: Cursor -- | Insertion point cursor for text. Text :: Cursor -- | Simple cross-hair. Crosshair :: Cursor -- | Bi-directional pointing up & down. UpDown :: Cursor -- | Bi-directional pointing left & right. LeftRight :: Cursor -- | Arrow pointing to top side. TopSide :: Cursor -- | Arrow pointing to bottom side. BottomSide :: Cursor -- | Arrow pointing to left side. LeftSide :: Cursor -- | Arrow pointing to right side. RightSide :: Cursor -- | Arrow pointing to top-left corner. TopLeftCorner :: Cursor -- | Arrow pointing to top-right corner. TopRightCorner :: Cursor -- | Arrow pointing to bottom-left corner. BottomRightCorner :: Cursor -- | Arrow pointing to bottom-right corner. BottomLeftCorner :: Cursor -- | Use parent's cursor. Inherit :: Cursor -- | Invisible cursor. None :: Cursor -- | Full-screen cross-hair cursor (if possible, otherwise -- Crosshair). FullCrosshair :: Cursor -- | Change the cursor image of the current window. Each call -- requests the window system change the cursor appropriately. The cursor -- image when a window is created is Inherit. The exact cursor -- images used are implementation dependent. The intent is for the image -- to convey the meaning of the cursor name. For a top-level window, -- Inherit uses the default window system cursor. -- -- X Implementation Notes: GLUT for X uses SGI's -- _SGI_CROSSHAIR_CURSOR convention to access a full-screen -- cross-hair cursor if possible. cursor :: StateVar Cursor -- | Setting pointerPosition warps the window system's pointer to a -- new location relative to the origin of the current window by -- the specified pixel offset, which may be negative. The warp is done -- immediately. -- -- If the pointer would be warped outside the screen's frame buffer -- region, the location will be clamped to the nearest screen edge. The -- window system is allowed to further constrain the pointer's location -- in window system dependent ways. -- -- Good advice from Xlib's XWarpPointer man page: "There is -- seldom any reason for calling this function. The pointer should -- normally be left to the user." pointerPosition :: SettableStateVar Position instance GHC.Show.Show Graphics.UI.GLUT.Window.Cursor instance GHC.Classes.Ord Graphics.UI.GLUT.Window.Cursor instance GHC.Classes.Eq Graphics.UI.GLUT.Window.Cursor instance GHC.Show.Show Graphics.UI.GLUT.Window.WindowStatus instance GHC.Classes.Ord Graphics.UI.GLUT.Window.WindowStatus instance GHC.Classes.Eq Graphics.UI.GLUT.Window.WindowStatus -- | When overlay hardware is available, GLUT provides a set of routines -- for establishing, using, and removing an overlay for GLUT windows. -- When an overlay is established, a separate OpenGL context is also -- established. A window's overlay OpenGL state is kept distinct from the -- normal planes' OpenGL state. module Graphics.UI.GLUT.Overlay -- | Controls the overlay for the current window. The requested -- display mode for the overlay is determined by the initial display -- mode. overlayPossible can be used to determine if an -- overlay is possible for the current window with the current -- initial display mode. Do not attempt to establish an overlay -- when one is not possible; GLUT will terminate the program. -- -- When hasOverlay is set to True when an overlay already -- exists, the existing overlay is first removed, and then a new overlay -- is established. The state of the old overlay's OpenGL context is -- discarded. Implicitly, the window's layer in use changes to the -- overlay immediately after the overlay is established. -- -- The initial display state of an overlay is shown, however the overlay -- is only actually shown if the overlay's window is shown. -- -- Setting hasOverlay to False is safe even if no overlay -- is currently established, nothing happens in this case. Implicitly, -- the window's /layer in use/ changes to the normal plane immediately -- once the overlay is removed. -- -- If the program intends to re-establish the overlay later, it is -- typically faster and less resource intensive to use -- overlayVisible to simply change the display status of the -- overlay. -- -- X Implementation Notes: GLUT for X uses the -- SERVER_OVERLAY_VISUALS convention to determine if overlay -- visuals are available. While the convention allows for opaque overlays -- (no transparency) and overlays with the transparency specified as a -- bitmask, GLUT overlay management only provides access to transparent -- pixel overlays. -- -- Until RGBA overlays are better understood, GLUT only supports color -- index overlays. hasOverlay :: StateVar Bool -- | Contains True if an overlay could be established for the -- current window given the current initial display mode. -- If it contains False, setting hasOverlay will fail with -- a fatal error. overlayPossible :: GettableStateVar Bool -- | Controls the visibility of the overlay of the current window. -- -- The effect of showing or hiding an overlay takes place immediately. -- Note that setting overlayVisible to True will not -- actually display the overlay unless the window is also shown (and even -- a shown window may be obscured by other windows, thereby obscuring the -- overlay). It is typically faster and less resource intensive to use -- the routines below to control the display status of an overlay as -- opposed to removing and re-establishing the overlay. overlayVisible :: SettableStateVar Bool -- | The layer in use. data Layer -- | The normal plane. Normal :: Layer -- | The overlay. Overlay :: Layer -- | Controls the per-window layer in use for the current -- window, which can either be the normal plane or the overlay. -- Selecting the overlay should only be done if an overlay exists, -- however windows without an overlay may still set the layer in -- use to Normal. OpenGL commands for the window are directed -- to the current layer in use. layerInUse :: StateVar Layer -- | Mark the overlay of the given window (or the current window, if -- none is supplied) as needing to be redisplayed. The next iteration -- through mainLoop, the window's overlay display callback (or -- simply the display callback if no overlay display callback is -- registered) will be called to redisplay the window's overlay plane. -- Multiple calls to postOverlayRedisplay before the next display -- callback opportunity (or overlay display callback opportunity if one -- is registered) generate only a single redisplay. -- postOverlayRedisplay may be called within a window's display or -- overlay display callback to re-mark that window for redisplay. -- -- Logically, overlay damage notification for a window is treated as a -- postOverlayRedisplay on the damaged window. Unlike damage -- reported by the window system, postOverlayRedisplay will not -- set to true the overlay's damaged status (see damaged). -- -- Also, see postRedisplay. postOverlayRedisplay :: MonadIO m => Maybe Window -> m () instance GHC.Show.Show Graphics.UI.GLUT.Overlay.Layer instance GHC.Classes.Ord Graphics.UI.GLUT.Overlay.Layer instance GHC.Classes.Eq Graphics.UI.GLUT.Overlay.Layer -- | GLUT maintains a considerable amount of programmer visible state. Some -- (but not all) of this state may be directly retrieved. module Graphics.UI.GLUT.State -- | (freeglut only) Contains the thickness of the sizing border -- around the perimeter of a window that can be resized, in pixels. windowBorderWidth :: GettableStateVar Int -- | (freeglut only) Contains the height of the header/caption area -- of a window in pixels. windowHeaderHeight :: GettableStateVar Int -- | (freeglut on X11 only) Controls if all but the last motion -- event should be discarded. skipStaleMotionEvents :: StateVar Bool -- | Contains True when the current layer of the current -- window is in RGBA mode, False means color index mode. rgba :: GettableStateVar Bool -- | Bit depth of a buffer type BufferDepth = Int -- | Contains the number of red, green, blue, and alpha bits in the color -- buffer of the current window's current layer (0 in color index -- mode). rgbaBufferDepths :: GettableStateVar (BufferDepth, BufferDepth, BufferDepth, BufferDepth) -- | Contains the total number of bits in the color buffer of the /current -- window's/ current layer. For an RGBA layer, this is the sum of the -- red, green, blue, and alpha bits. For an color index layer, this is -- the number of bits of the color indexes. colorBufferDepth :: GettableStateVar BufferDepth -- | Contains True when the current layer of the current -- window is double buffered, False otherwise. doubleBuffered :: GettableStateVar Bool -- | Contains True when the current layer of the current -- window is stereo, False otherwise. stereo :: GettableStateVar Bool -- | Contains the number of red, green, blue, and alpha bits in the -- accumulation buffer of the current window's current layer (0 in -- color index mode). accumBufferDepths :: GettableStateVar (BufferDepth, BufferDepth, BufferDepth, BufferDepth) -- | Contains the number of bits in the depth buffer of the current -- window's current layer. depthBufferDepth :: GettableStateVar BufferDepth -- | Contains the number of bits in the stencil buffer of the /current -- window's/ current layer. stencilBufferDepth :: GettableStateVar BufferDepth -- | Number of samples for multisampling type SampleCount = Int -- | Contains the number of samples for multisampling for the current -- window. sampleCount :: GettableStateVar SampleCount -- | Contains the window system dependent format ID for the current layer -- of the current window. On X11 GLUT implementations, this is the -- X visual ID. On Win32 GLUT implementations, this is the Win32 Pixel -- Format Descriptor number. This value is returned for debugging, -- benchmarking, and testing ease. formatID :: GettableStateVar Int -- | (freeglut only) Contains True if the current -- window is in full screen mode, False otherwise. fullScreenMode :: StateVar Bool -- | (freeglut only) Controls if vectors representing the normals -- should be drawn, too, when objects are drawn. geometryVisualizeNormals :: StateVar Bool -- | (freeglut only) If vertexAttribCoord3 and -- vertexAttribNormal both contain Nothing, the fixed -- function pipeline is used to draw objects. Otherwise VBOs are used and -- the coordinates are passed via Just this attribute location -- (for a vec3). vertexAttribCoord3 :: SettableStateVar (Maybe AttribLocation) -- | (freeglut only) If vertexAttribCoord3 and -- vertexAttribNormal both contain Nothing, the fixed -- function pipeline is used to draw objects. Otherwise VBOs are used and -- the normals are passed via Just this attribute location (for a -- vec3). vertexAttribNormal :: SettableStateVar (Maybe AttribLocation) -- | (freeglut only) If VBOs are used to draw objects (controlled -- via vertexAttribCoord3 and vertexAttribNormal), the -- texture coordinates are passed via Just this attribute location -- (for a vec2). vertexAttribTexCoord2 :: SettableStateVar (Maybe AttribLocation) -- | Contains True if the given plane of the current window -- has been damaged (by window system activity) since the last display -- callback was triggered. Calling postRedisplay or -- postOverlayRedisplay will not set this True. damaged :: Layer -> GettableStateVar Bool -- | Contains the number of milliseconds since initialize was -- called. elapsedTime :: GettableStateVar Int -- | The size of the screen in pixels. screenSize :: GettableStateVar Size -- | The size of the screen in millimeters. screenSizeMM :: GettableStateVar Size -- | Contains True if a keyboard is present, False otherwise. hasKeyboard :: GettableStateVar Bool -- | Number of buttons of an input device type ButtonCount = Int -- | Contains Just the number of buttons of an attached mouse or -- Nothing if there is none. numMouseButtons :: GettableStateVar (Maybe ButtonCount) -- | Contains Just the number of buttons of the attached Spaceball -- or Nothing if there is none. numSpaceballButtons :: GettableStateVar (Maybe ButtonCount) -- | Number of dials of a dial and button box type DialCount = Int -- | Contains Just the number of dials and buttons of an attached -- dial & button box or Nothing if there is none. numDialsAndButtons :: GettableStateVar (Maybe (DialCount, ButtonCount)) -- | Contains Just the number of buttons of an attached tablet or -- Nothing if there is none. numTabletButtons :: GettableStateVar (Maybe ButtonCount) -- | Number of axes of a joystick type AxisCount = Int -- | The a rate at which a joystick is polled (in milliseconds) type PollRate = Int -- | Contains Just the number of buttons of an attached joystick, -- the number of joystick axes, and the rate at which the joystick is -- polled. Contains Nothing if there is no joystick attached. joystickInfo :: GettableStateVar (Maybe (ButtonCount, PollRate, AxisCount)) -- | (freeglut only) Contains a list of the number of auxiliary -- buffers supported, in increasing order. supportedNumAuxBuffers :: GettableStateVar [Int] -- | (freeglut only) Contains a list of the number of samples per -- pixel supported for multisampling, in increasing order. supportedSamplesPerPixel :: GettableStateVar [SampleCount] -- | Contains version of GLUT in the form of flavour -- major.minor.patchlevel, where -- flavour is one of GLUT, freeglut or -- OpenGLUT. glutVersion :: GettableStateVar String -- | (freeglut only) Contains True if GLUT has been -- initialized with initialize or getArgsAndInitialize has -- and not yet been de-initialized with exit. Contains -- False otherwise. initState :: GettableStateVar Bool -- | GLUT includes a number of routines for generating easily recognizable -- 3D geometric objects. These routines reflect functionality available -- in the aux toolkit described in the OpenGL Programmer's -- Guide and are included in GLUT to allow the construction of simple -- GLUT programs that render recognizable objects. These routines can be -- implemented as pure OpenGL rendering routines. The routines do not -- generate display lists for the objects they create. The routines -- generate normals appropriate for lighting but do not generate texture -- coordinates (except for the solid teapot, teacup and teaspoon). If -- VBOs should be used instead of the fixed function pipeline, specify at -- least one of the attribute locations vertexAttribCoord3 or -- vertexAttribNormal. module Graphics.UI.GLUT.Objects -- | Flavour of object rendering data Flavour -- | Object is rendered as a solid with shading and surface normals. Solid :: Flavour -- | Object is rendered as a wireframe without surface normals. Wireframe :: Flavour -- | GLUT offers five types of objects: -- -- data Object -- | A cube centered at the modeling coordinates origin with sides of the -- given length. Cube :: Height -> Object -- | A dodecahedron (12-sided regular solid) centered at the modeling -- coordinates origin with a radius of sqrt 3. Dodecahedron :: Object -- | A icosahedron (20-sided regular solid) centered at the modeling -- coordinates origin with a radius of 1.0. Icosahedron :: Object -- | Render a solid octahedron (8-sided regular solid) centered at the -- modeling coordinates origin with a radius of 1.0. Octahedron :: Object -- | Render a solid tetrahedron (4-sided regular solid) centered at the -- modeling coordinates origin with a radius of sqrt 3. Tetrahedron :: Object -- | (freeglut only) A rhombic dodecahedron whose corners are at -- most a distance of one from the origin. The rhombic dodecahedron has -- faces which are identical rhombi, but which have some vertices at -- which three faces meet and some vertices at which four faces meet. The -- length of each side is (sqrt 3)/2. Vertices at which four -- faces meet are found at (0, 0, +/-1) and (+/-(sqrt 2)/2, -- +/-(sqrt 2)/2, 0). RhombicDodecahedron :: Object -- | A sphere centered at the modeling coordinates origin of the specified -- radius. The sphere is subdivided around the Z axis into slices -- (similar to lines of longitude) and along the Z axis into stacks -- (similar to lines of latitude). Sphere' :: Radius -> Slices -> Stacks -> Object -- | A cone oriented along the Z axis. The base of the cone is placed at Z -- = 0, and the top at Z = the given height. The cone is subdivided -- around the Z axis into slices, and along the Z axis into stacks. Cone :: Radius -> Height -> Slices -> Stacks -> Object -- | (freeglut only) A cylinder oriented along the Z axis. The base -- of the cylinder is placed at Z = 0, and the top at Z = the given -- height. The cylinder is subdivided around the Z axis into slices, and -- along the Z axis into stacks. Cylinder' :: Radius -> Height -> Slices -> Stacks -> Object -- | A torus (doughnut) centered at the modeling coordinates origin whose -- axis is aligned with the Z axis. The torus is described by its inner -- and outer radius, the number of sides for each radial section, and the -- number of radial divisions (rings). Torus :: Radius -> Radius -> Sides -> Rings -> Object -- | A teapot with a given relative size. Teapot :: Height -> Object -- | (freeglut only) A teacup with a given relative size. Teacup :: Height -> Object -- | (freeglut only) A teaspoon with a given relative size. Teaspoon :: Height -> Object -- | (freeglut only) A Sierpinski sponge of a given level, where a -- level 0 sponge is the same as a Tetrahedron. SierpinskiSponge :: NumLevels -> Object type Sides = GLint type Rings = GLint type NumLevels = GLint -- | Render an object in the given flavour. renderObject :: MonadIO m => Flavour -> Object -> m () instance GHC.Show.Show Graphics.UI.GLUT.Objects.Object instance GHC.Classes.Ord Graphics.UI.GLUT.Objects.Object instance GHC.Classes.Eq Graphics.UI.GLUT.Objects.Object instance GHC.Show.Show Graphics.UI.GLUT.Objects.Flavour instance GHC.Classes.Ord Graphics.UI.GLUT.Objects.Flavour instance GHC.Classes.Eq Graphics.UI.GLUT.Objects.Flavour -- | Actions and state variables in this module are used to initialize GLUT -- state. The primary initialization routine is initialize, which -- should only be called exactly once in a GLUT program. No other GLUT or -- OpenGL actions should be called before initialize, apart from -- getting or setting the state variables in this module. -- -- The reason is that these state variables can be used to set default -- window initialization state that might be modified by the command -- processing done in initialize. For example, -- initialWindowSize can be set to (Size 400 400) -- before initialize is called to indicate 400 by 400 is the -- program's default window size. Setting the initial window size or -- position before initialize allows the GLUT program user to -- specify the initial size or position using command line arguments. module Graphics.UI.GLUT.Initialization -- | Given the program name and command line arguments, initialize the GLUT -- library and negotiate a session with the window system. During this -- process, initialize may cause the termination of the GLUT -- program with an error message to the user if GLUT cannot be properly -- initialized. Examples of this situation include the failure to connect -- to the window system, the lack of window system support for OpenGL, -- and invalid command line options. -- -- initialize also processes command line options, but the -- specific options parsed are window system dependent. Any command line -- arguments which are not GLUT-specific are returned. -- -- X Implementation Notes: The X Window System specific options -- parsed by initialize are as follows: -- -- initialize :: MonadIO m => String -> [String] -> m [String] -- | Convenience action: Initialize GLUT, returning the program name and -- any non-GLUT command line arguments. getArgsAndInitialize :: MonadIO m => m (String, [String]) -- | (freeglut only) De-initialize GLUT. After this, one has to use -- initialize or getArgsAndInitialize to initialize GLUT -- again. exit :: MonadIO m => m () -- | Controls the initial window position. Windows created by -- createWindow will be requested to be created with the current -- initial window position. The initial value of the /initial -- window position/ GLUT state is Position (-1) (-1). If -- either the X or Y component of the initial window position is -- negative, the actual window position is left to the window system to -- determine. -- -- The intent of the initial window position is to provide a -- suggestion to the window system for a window's initial position. The -- window system is not obligated to use this information. Therefore, -- GLUT programs should not assume the window was created at the -- specified position. initialWindowPosition :: StateVar Position -- | Controls the initial window size. Windows created by -- createWindow will be requested to be created with the current -- initial window size. The initial value of the /initial window -- size/ GLUT state is Size 300 300. If either the width -- or the height component of the initial window size is -- non-positive, the actual window size is left to the window system to -- determine. -- -- The intent of the initial window size is to provide a -- suggestion to the window system for a window's initial size. The -- window system is not obligated to use this information. Therefore, -- GLUT programs should not assume the window was created at the -- specified size. A GLUT program should use the window's reshape -- callback to determine the true size of the window. initialWindowSize :: StateVar Size -- | A single aspect of a window which is to be created, used in -- conjunction with initialDisplayMode. data DisplayMode -- | Select an RGBA mode window. This is the default if neither -- RGBAMode nor IndexMode are specified. RGBAMode :: DisplayMode -- | An alias for RGBAMode. RGBMode :: DisplayMode -- | Select a color index mode window. This overrides RGBAMode if it -- is also specified. IndexMode :: DisplayMode -- | Select a window with a "luminance" color model. This model provides -- the functionality of OpenGL's RGBA color model, but the green and blue -- components are not maintained in the frame buffer. Instead each -- pixel's red component is converted to an index between zero and -- numColorMapEntries and looked up in a per-window color map to -- determine the color of pixels within the window. The initial colormap -- of LuminanceMode windows is initialized to be a linear gray -- ramp, but can be modified with GLUT's colormap actions. -- Implementation Notes: LuminanceMode is not supported on -- most OpenGL platforms. LuminanceMode :: DisplayMode -- | Select a window with an alpha component to the color buffer(s). WithAlphaComponent :: DisplayMode -- | Select a window with an accumulation buffer. WithAccumBuffer :: DisplayMode -- | Select a window with a depth buffer. WithDepthBuffer :: DisplayMode -- | Select a window with a stencil buffer. WithStencilBuffer :: DisplayMode -- | (freeglut only) Select a window with n (1 .. 4) -- auxiliary buffers. Any n outside the range 1 .. 4 is a fatal -- error. WithAuxBuffers :: Int -> DisplayMode -- | Select a single buffered window. This is the default if neither -- DoubleBuffered nor SingleBuffered are specified. SingleBuffered :: DisplayMode -- | Select a double buffered window. This overrides SingleBuffered -- if it is also specified. DoubleBuffered :: DisplayMode -- | Select a window with multisampling support. If multisampling is not -- available, a non-multisampling window will automatically be chosen. -- Note: both the OpenGL client-side and server-side implementations must -- support the GLX_SAMPLE_SGIS extension for multisampling to be -- available. Deprecated, use WithSamplesPerPixel. Multisampling :: DisplayMode -- | Select a window with multisampling, using the given samples per pixel. WithSamplesPerPixel :: Int -> DisplayMode -- | Select a stereo window. Stereoscopic :: DisplayMode -- | Select a window without a caption (freeglut only). Captionless :: DisplayMode -- | Select a window without any borders (freeglut only). Borderless :: DisplayMode -- | Select an sRGB mode window (freeglut only). SRGBMode :: DisplayMode -- | Controls the initial display mode used when creating top-level -- windows, subwindows, and overlays to determine the OpenGL display mode -- for the to-be-created window or overlay. -- -- Note that RGBAMode selects the RGBA color model, but it does -- not request any bits of alpha (sometimes called an alpha buffer -- or destination alpha) be allocated. To request alpha, specify -- WithAlphaComponent. The same applies to LuminanceMode. initialDisplayMode :: StateVar [DisplayMode] -- | Contains True if the current display mode is supported, -- False otherwise. displayModePossible :: GettableStateVar Bool -- | Capabilities for initialDisplayCapabilities, most of them are -- extensions of the constructors of DisplayMode. data DisplayCapability -- | Number of bits of red, green, blue, and alpha in the RGBA color -- buffer. Default is "IsAtLeast 1" for red, green, blue, -- and alpha capabilities, and "IsEqualTo 1" for the RGBA -- color model capability. DisplayRGBA :: DisplayCapability -- | Number of bits of red, green, and blue in the RGBA color buffer and -- zero bits of alpha color buffer precision. Default is -- "IsAtLeast 1" for the red, green, and blue -- capabilities, and "IsNotLessThan 0" for alpha -- capability, and "IsEqualTo 1" for the RGBA color model -- capability. DisplayRGB :: DisplayCapability -- | Red color buffer precision in bits. Default is "IsAtLeast -- 1". DisplayRed :: DisplayCapability -- | Green color buffer precision in bits. Default is "IsAtLeast -- 1". DisplayGreen :: DisplayCapability -- | Blue color buffer precision in bits. Default is "IsAtLeast -- 1". DisplayBlue :: DisplayCapability -- | Boolean if the color model is color index or not. True is color index. -- Default is "IsAtLeast 1". DisplayIndex :: DisplayCapability -- | Number of bits in the color index color buffer. Default is -- "IsAtLeast 1". DisplayBuffer :: DisplayCapability -- | Boolean indicate the color buffer is single buffered. Default is -- "IsEqualTo 1". DisplaySingle :: DisplayCapability -- | Boolean indicating if the color buffer is double buffered. Default is -- "IsEqualTo 1". DisplayDouble :: DisplayCapability -- | Red, green, blue, and alpha accumulation buffer precision in bits. -- Default is "IsAtLeast 1" for red, green, blue, and -- alpha capabilities. DisplayAccA :: DisplayCapability -- | Red, green, and green accumulation buffer precision in bits and zero -- bits of alpha accumulation buffer precision. Default is -- "IsAtLeast 1" for red, green, and blue capabilities, -- and "IsNotLessThan 0" for the alpha capability. DisplayAcc :: DisplayCapability -- | Alpha color buffer precision in bits. Default is "IsAtLeast -- 1". DisplayAlpha :: DisplayCapability -- | Number of bits of precsion in the depth buffer. Default is -- "IsAtLeast 12". DisplayDepth :: DisplayCapability -- | Number of bits in the stencil buffer. Default is "IsNotLessThan -- 1". DisplayStencil :: DisplayCapability -- | Indicates the number of multisamples to use based on GLX's -- SGIS_multisample extension (for antialiasing). Default is -- "IsNotGreaterThan 4". This default means that a GLUT -- application can request multisampling if available by simply -- specifying "With DisplaySamples". DisplaySamples :: DisplayCapability -- | Boolean indicating the color buffer is supports OpenGL-style stereo. -- Default is "IsEqualTo 1". DisplayStereo :: DisplayCapability -- | Number of bits of red in the RGBA and zero bits of green, blue (alpha -- not specified) of color buffer precision. Default is "IsAtLeast -- 1" for the red capabilitis, and "IsEqualTo 0" -- for the green and blue capabilities, and "IsEqualTo 1" -- for the RGBA color model capability, and, for X11, "IsEqualTo -- 1" for the DisplayXStaticGray capability. SGI -- InfiniteReality (and other future machines) support a 16-bit luminance -- (single channel) display mode (an additional 16-bit alpha channel can -- also be requested). The red channel maps to gray scale and green and -- blue channels are not available. A 16-bit precision luminance display -- mode is often appropriate for medical imaging applications. Do not -- expect many machines to support extended precision luminance display -- modes. DisplayLuminance :: DisplayCapability -- | (freeglut only) Number of auxiliary buffers. Default is -- "IsEqualTo 1". DisplayAux :: DisplayCapability -- | A special capability name indicating where the value represents the -- Nth frame buffer configuration matching the description string. When -- not specified, initialDisplayCapabilities also uses the first -- (best matching) configuration. Num requires a relation and -- numeric value. DisplayNum :: DisplayCapability -- | Boolean indicating if the frame buffer configuration is conformant or -- not. Conformance information is based on GLX's -- EXT_visual_rating extension if supported. If the extension is -- not supported, all visuals are assumed conformant. Default is -- "IsEqualTo 1". DisplayConformant :: DisplayCapability -- | Boolean indicating if the frame buffer configuration is slow or not. -- Slowness information is based on GLX's EXT_visual_rating -- extension if supported. If the extension is not supported, all visuals -- are assumed fast. Note that slowness is a relative designation -- relative to other frame buffer configurations available. The intent of -- the slow capability is to help programs avoid frame buffer -- configurations that are slower (but perhaps higher precision) for the -- current machine. Default is "IsAtLeast 0". This -- default means that slow visuals are used in preference to fast -- visuals, but fast visuals will still be allowed. DisplaySlow :: DisplayCapability -- | Only recognized on GLUT implementations for Win32, this capability -- name matches the Win32 Pixel Format Descriptor by number. -- DisplayWin32PFD can only be used with Where. DisplayWin32PFD :: DisplayCapability -- | Only recongized on GLUT implementations for the X Window System, this -- capability name matches the X visual ID by number. -- DisplayXVisual requires a relation and numeric value. DisplayXVisual :: DisplayCapability -- | Only recongized on GLUT implementations for the X Window System, -- boolean indicating if the frame buffer configuration's X visual is of -- type StaticGray. Default is "IsEqualTo 1". DisplayXStaticGray :: DisplayCapability -- | Only recongized on GLUT implementations for the X Window System, -- boolean indicating if the frame buffer configuration's X visual is of -- type GrayScale. Default is "IsEqualTo 1". DisplayXGrayScale :: DisplayCapability -- | Only recongized on GLUT implementations for the X Window System, -- boolean indicating if the frame buffer configuration's X visual is of -- type StaticColor. Default is "IsEqualTo 1". DisplayXStaticColor :: DisplayCapability -- | Only recongized on GLUT implementations for the X Window System, -- boolean indicating if the frame buffer configuration's X visual is of -- type PsuedoColor. Default is "IsEqualTo 1". DisplayXPseudoColor :: DisplayCapability -- | Only recongized on GLUT implementations for the X Window System, -- boolean indicating if the frame buffer configuration's X visual is of -- type TrueColor. Default is "IsEqualTo 1". DisplayXTrueColor :: DisplayCapability -- | Only recongized on GLUT implementations for the X Window System, -- boolean indicating if the frame buffer configuration's X visual is of -- type DirectColor. Default is "IsEqualTo 1". DisplayXDirectColor :: DisplayCapability -- | A relation between a DisplayCapability and a numeric value. data Relation -- | Equal. IsEqualTo :: Relation -- | Not equal. IsNotEqualTo :: Relation -- | Less than and preferring larger difference (the least is best). IsLessThan :: Relation -- | Less than or equal and preferring larger difference (the least is -- best). IsNotGreaterThan :: Relation -- | Greater than and preferring larger differences (the most is best). IsGreaterThan :: Relation -- | Greater than or equal and preferring more instead of less. This -- relation is useful for allocating resources like color precision or -- depth buffer precision where the maximum precision is generally -- preferred. Contrast with IsNotLessThan relation. IsAtLeast :: Relation -- | Greater than or equal but preferring less instead of more. This -- relation is useful for allocating resources such as stencil bits or -- auxillary color buffers where you would rather not over-allocate. IsNotLessThan :: Relation -- | A single capability description for initialDisplayCapabilities. data DisplayCapabilityDescription -- | A description of a capability with a specific relation to a numeric -- value. Where :: DisplayCapability -> Relation -> Int -> DisplayCapabilityDescription -- | When the relation and numeric value are not specified, each capability -- has a different default, see the different constructors of -- DisplayCapability. With :: DisplayCapability -> DisplayCapabilityDescription -- | Controls the initial display mode used when creating top-level -- windows, subwindows, and overlays to determine the OpenGL display mode -- for the to-be-created window or overlay. It is described by a list of -- zero or more capability descriptions, which are translated into a set -- of criteria used to select the appropriate frame buffer configuration. -- The criteria are matched in strict left to right order of precdence. -- That is, the first specified criterion (leftmost) takes precedence -- over the later criteria for non-exact criteria (IsGreaterThan, -- IsLessThan, etc.). Exact criteria (IsEqualTo, -- IsNotEqualTo) must match exactly so precedence is not relevant. -- -- Unspecified capability descriptions will result in unspecified -- criteria being generated. These unspecified criteria help -- initialDisplayCapabilities behave sensibly with terse display -- mode descriptions. -- -- Here is an example using initialDisplayCapabilities: -- --
--   initialDisplayCapabilities $= [ With  DisplayRGB,
--                                   Where DisplayDepth IsAtLeast 16,
--                                   With  DisplaySamples,
--                                   Where DisplayStencil IsNotLessThan 2,
--                                   With  DisplayDouble ]
--   
-- -- The above call requests a window with an RGBA color model (but -- requesting no bits of alpha), a depth buffer with at least 16 bits of -- precision but preferring more, multisampling if available, at least 2 -- bits of stencil (favoring less stencil to more as long as 2 bits are -- available), and double buffering. initialDisplayCapabilities :: SettableStateVar [DisplayCapabilityDescription] -- | How rendering context for new windows are created. data RenderingContext -- | Create a new context via glXCreateContext or -- wglCreateContext (default). CreateNewContext :: RenderingContext -- | Re-use the current rendering context. UseCurrentContext :: RenderingContext -- | (freeglut only) Controls the creation of rendering contexts for -- new windows. renderingContext :: StateVar RenderingContext -- | The kind of GLX rendering context used. Direct rendering provides a -- performance advantage in some implementations. However, direct -- rendering contexts cannot be shared outside a single process, and they -- may be unable to render to GLX pixmaps. data DirectRendering -- | Rendering is always done through the X server. This corresponds to the -- command line argument -indirect, see initialize. ForceIndirectContext :: DirectRendering -- | Try to use direct rendering, silently using indirect rendering if this -- is not possible. AllowDirectContext :: DirectRendering -- | Try to use direct rendering, issue a warning and use indirect -- rendering if this is not possible. TryDirectContext :: DirectRendering -- | Try to use direct rendering, issue an error and terminate the program -- if this is not possible.This corresponds to the command line argument -- -direct, see initialize. ForceDirectContext :: DirectRendering -- | (freeglut on X11 only) Controls which kind of rendering context -- is created when a new one is required. directRendering :: StateVar DirectRendering -- | (freeglut only) Controls the API major/minor version of the -- OpenGL context. If a version less than or equal to 2.1 is requested, -- the context returned may implement any version no less than that -- requested and no greater than 2.1. If version 3.0 is requested, the -- context returned must implement exactly version 3.0. Versioning -- behavior once GL versions beyond 3.0 are defined will be defined by an -- amendment to the OpenGL specification to define dependencies on such -- GL versions. -- -- glVersion and majorMinor will return the actual version -- supported by a context. -- -- The default context version is (1, 0), which will typically return an -- OpenGL 2.1 context, if one is available. initialContextVersion :: StateVar (Int, Int) -- | A flag affecting the rendering context to create, used in conjunction -- with initialContextFlags. data ContextFlag -- | Debug contexts are intended for use during application development, -- and provide additional runtime checking, validation, and logging -- functionality while possibly incurring performance penalties. The -- additional functionality provided by debug contexts may vary according -- to the implementation. In some cases a debug context may be identical -- to a non-debug context. DebugContext :: ContextFlag -- | Forward-compatible contexts are defined only for OpenGL versions 3.0 -- and later. They must not support functionality marked as -- deprecated by that version of the API, while a -- non-forward-compatible context must support all functionality in that -- version, deprecated or not. ForwardCompatibleContext :: ContextFlag -- | (freeglut only) Controls the set of flags for the rendering -- context. initialContextFlags :: StateVar [ContextFlag] -- | An OpenGL API profile, affecting the rendering context to create, used -- in conjunction with initialContextProfile. data ContextProfile -- | The OpenGL core profile, which all OpenGL 3.2 implementations -- are required to support. CoreProfile :: ContextProfile -- | The OpenGL compatibility profile, which is optional for OpenGL -- 3.2 implementations. CompatibilityProfile :: ContextProfile -- | (freeglut only) Controls the set of profiles for the rendering -- context. initialContextProfile :: StateVar [ContextProfile] instance GHC.Show.Show Graphics.UI.GLUT.Initialization.ContextProfile instance GHC.Classes.Ord Graphics.UI.GLUT.Initialization.ContextProfile instance GHC.Classes.Eq Graphics.UI.GLUT.Initialization.ContextProfile instance GHC.Show.Show Graphics.UI.GLUT.Initialization.ContextFlag instance GHC.Classes.Ord Graphics.UI.GLUT.Initialization.ContextFlag instance GHC.Classes.Eq Graphics.UI.GLUT.Initialization.ContextFlag instance GHC.Show.Show Graphics.UI.GLUT.Initialization.DirectRendering instance GHC.Classes.Ord Graphics.UI.GLUT.Initialization.DirectRendering instance GHC.Classes.Eq Graphics.UI.GLUT.Initialization.DirectRendering instance GHC.Show.Show Graphics.UI.GLUT.Initialization.RenderingContext instance GHC.Classes.Ord Graphics.UI.GLUT.Initialization.RenderingContext instance GHC.Classes.Eq Graphics.UI.GLUT.Initialization.RenderingContext instance GHC.Show.Show Graphics.UI.GLUT.Initialization.DisplayCapabilityDescription instance GHC.Classes.Ord Graphics.UI.GLUT.Initialization.DisplayCapabilityDescription instance GHC.Classes.Eq Graphics.UI.GLUT.Initialization.DisplayCapabilityDescription instance GHC.Show.Show Graphics.UI.GLUT.Initialization.DisplayCapability instance GHC.Classes.Ord Graphics.UI.GLUT.Initialization.DisplayCapability instance GHC.Classes.Eq Graphics.UI.GLUT.Initialization.DisplayCapability instance GHC.Show.Show Graphics.UI.GLUT.Initialization.DisplayMode instance GHC.Classes.Ord Graphics.UI.GLUT.Initialization.DisplayMode instance GHC.Classes.Eq Graphics.UI.GLUT.Initialization.DisplayMode -- | In addition to the functionality offered by fullScreen, GLUT -- offers an sub-API to change the screen resolution, color depth, and -- refresh rate of the display for a single full screen window. This mode -- of operation is called game mode, and is restricted in various -- ways: No pop-up menus are allowed for this full screen window, no -- other (sub-)windows can be created, and all other applications are -- hidden. -- -- X Implementation Notes: Note that game mode is not fully -- supported in the original GLUT for X, it is essentially the same as -- using fullScreen. The GLUT clone freeglut (see -- http://freeglut.sourceforge.net/) does not have this -- restriction. module Graphics.UI.GLUT.GameMode -- | Capabilities for gameModeCapabilities data GameModeCapability -- | Width of the screen resolution in pixels GameModeWidth :: GameModeCapability -- | Height of the screen resolution in pixels GameModeHeight :: GameModeCapability -- | Color depth of the screen in bits GameModeBitsPerPlane :: GameModeCapability -- | Refresh rate in Hertz GameModeRefreshRate :: GameModeCapability -- | Match the Nth frame buffer configuration compatible with the given -- capabilities (numbering starts at 1) GameModeNum :: GameModeCapability -- | A single capability description for gameModeCapabilities. data GameModeCapabilityDescription Where' :: GameModeCapability -> Relation -> Int -> GameModeCapabilityDescription -- | Controls the game mode to be used when enterGameMode is -- called. It is described by a list of zero or more capability -- descriptions, which are translated into a set of criteria used to -- select the appropriate screen configuration. The criteria are matched -- in strict left to right order of precdence. That is, the first -- specified criterion (leftmost) takes precedence over the later -- criteria for non-exact criteria (IsGreaterThan, -- IsLessThan, etc.). Exact criteria (IsEqualTo, -- IsNotEqualTo) must match exactly so precedence is not relevant. -- -- To determine which configuration will actually be tried by -- enterGameMode (if any), use gameModeInfo. -- -- Note that even for game mode the current values of -- initialDisplayModeor initialDisplayCapabilities will -- determine which buffers are available, if double buffering is used or -- not, etc. gameModeCapabilities :: SettableStateVar [GameModeCapabilityDescription] -- | Enter game mode, trying to change resolution, refresh rate, -- etc., as specified by the current value of -- gameModeCapabilities. An identifier for the game mode window -- and a flag, indicating if the display mode actually changed, are -- returned. The game mode window is made the current window. -- -- Re-entering game mode is allowed, the previous game mode window -- gets destroyed by this, and a new one is created. enterGameMode :: MonadIO m => m (Window, Bool) -- | Leave game mode, restoring the old display mode and destroying -- the game mode window. leaveGameMode :: MonadIO m => m () -- | The color depth of the screen, measured in bits (e.g. 8, 16, 24, 32, -- ...) type BitsPerPlane = Int -- | The refresh rate of the screen, measured in Hertz (e.g. 60, 75, 100, -- ...) type RefreshRate = Int data GameModeInfo GameModeInfo :: Size -> BitsPerPlane -> RefreshRate -> GameModeInfo -- | Return Just the mode which would be tried by the next call to -- enterGameMode. Returns Nothing if the mode requested by -- the current value of gameModeCapabilities is not possible, in -- which case enterGameMode would simply create a full screen -- window using the current mode. gameModeInfo :: GettableStateVar (Maybe GameModeInfo) -- | Contains True when the game mode is active, False -- otherwise. gameModeActive :: GettableStateVar Bool instance GHC.Show.Show Graphics.UI.GLUT.GameMode.GameModeInfo instance GHC.Classes.Ord Graphics.UI.GLUT.GameMode.GameModeInfo instance GHC.Classes.Eq Graphics.UI.GLUT.GameMode.GameModeInfo instance GHC.Show.Show Graphics.UI.GLUT.GameMode.GameModeCapabilityDescription instance GHC.Classes.Ord Graphics.UI.GLUT.GameMode.GameModeCapabilityDescription instance GHC.Classes.Eq Graphics.UI.GLUT.GameMode.GameModeCapabilityDescription instance GHC.Show.Show Graphics.UI.GLUT.GameMode.GameModeCapability instance GHC.Classes.Ord Graphics.UI.GLUT.GameMode.GameModeCapability instance GHC.Classes.Eq Graphics.UI.GLUT.GameMode.GameModeCapability -- | GLUT supports two types of font rendering: stroke fonts, meaning each -- character is rendered as a set of line segments; and bitmap fonts, -- where each character is a bitmap generated with bitmap. Stroke -- fonts have the advantage that because they are geometry, they can be -- arbitrarily scale and rendered. Bitmap fonts are less flexible since -- they are rendered as bitmaps but are usually faster than stroke fonts. module Graphics.UI.GLUT.Fonts class Font a -- | Render the string in the named font, without using any display lists. -- Rendering a nonexistent character has no effect. -- -- If the font is a bitmap font, renderString automatically sets -- the OpenGL unpack pixel storage modes it needs appropriately and saves -- and restores the previous modes before returning. The generated call -- to bitmap will adjust the current raster position based on the -- width of the string. If the font is a stroke font, translate is -- used to translate the current model view matrix to advance the width -- of the string. renderString :: (Font a, MonadIO m) => a -> String -> m () -- | For a bitmap font, return the width in pixels of a string. For a -- stroke font, return the width in units. While the width of characters -- in a font may vary (though fixed width fonts do not vary), the maximum -- height characteristics of a particular font are fixed. stringWidth :: (Font a, MonadIO m) => a -> String -> m GLint -- | (freeglut only) For a bitmap font, return the maximum height of -- the characters in the given font measured in pixels. For a stroke -- font, return the width in units. fontHeight :: (Font a, MonadIO m) => a -> m GLfloat -- | The bitmap fonts available in GLUT. The exact bitmap to be used is -- defined by the standard X glyph bitmaps for the X font with the given -- name. data BitmapFont -- | A fixed width font with every character fitting in an 8 by 13 pixel -- rectangle. -- (-misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1) Fixed8By13 :: BitmapFont -- | A fixed width font with every character fitting in an 9 by 15 pixel -- rectangle. -- (-misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1) Fixed9By15 :: BitmapFont -- | A 10-point proportional spaced Times Roman font. -- (-adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1) TimesRoman10 :: BitmapFont -- | A 24-point proportional spaced Times Roman font. -- (-adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1) TimesRoman24 :: BitmapFont -- | A 10-point proportional spaced Helvetica font. -- (-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1) Helvetica10 :: BitmapFont -- | A 12-point proportional spaced Helvetica font. -- (-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1) Helvetica12 :: BitmapFont -- | A 18-point proportional spaced Helvetica font. -- (-adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1) Helvetica18 :: BitmapFont -- | The stroke fonts available in GLUT. data StrokeFont -- | A proportionally spaced Roman Simplex font for ASCII characters 32 -- through 127. The maximum top character in the font is 119.05 units; -- the bottom descends 33.33 units. Roman :: StrokeFont -- | A mono-spaced spaced Roman Simplex font (same characters as -- Roman) for ASCII characters 32 through 127. The maximum top -- character in the font is 119.05 units; the bottom descends 33.33 -- units. Each character is 104.76 units wide. MonoRoman :: StrokeFont instance Graphics.UI.GLUT.Fonts.Font Graphics.UI.GLUT.Raw.Fonts.BitmapFont instance Graphics.UI.GLUT.Fonts.Font Graphics.UI.GLUT.Raw.Fonts.StrokeFont -- | GLUT offers some routines for controlling the key repeat and polling -- the joystick. module Graphics.UI.GLUT.DeviceControl -- | The state of the global key repeat data GlobalKeyRepeat GlobalKeyRepeatOff :: GlobalKeyRepeat GlobalKeyRepeatOn :: GlobalKeyRepeat GlobalKeyRepeatDefault :: GlobalKeyRepeat -- | Controls the key repeat mode for the window system on a global basis -- if possible. If supported by the window system, the key repeat can -- either be disabled, enabled, or set to the window system's default key -- repeat state. -- -- X Implementation Notes: X11 sends KeyPress events -- repeatedly when the window system's global auto repeat is enabled. -- perWindowKeyRepeat can prevent these auto repeated keystrokes -- from being reported as keyboard or special callbacks, but there is -- still some minimal overhead by the X server to continually stream -- KeyPress events to the GLUT application. The -- globalKeyRepeat state variable can be used to actually disable -- the global sending of auto repeated KeyPress events. Note -- that globalKeyRepeat affects the global window system auto -- repeat state so other applications will not auto repeat if you disable -- auto repeat globally through globalKeyRepeat. GLUT applications -- using the X11 GLUT implementation should disable key repeat with -- globalKeyRepeat to disable key repeats most efficiently, but -- are responsible for explicitly restoring the default key repeat state -- on exit. -- -- Win32 Implementation Notes: The Win32 implementation of -- globalKeyRepeat does nothing. The perWindowKeyRepeat can -- be used in the Win32 GLUT implementation to ignore repeated keys on a -- per-window basis without changing the global window system key repeat. globalKeyRepeat :: StateVar GlobalKeyRepeat -- | The state of the per-window key repeat data PerWindowKeyRepeat PerWindowKeyRepeatOff :: PerWindowKeyRepeat PerWindowKeyRepeatOn :: PerWindowKeyRepeat -- | Controls if auto repeat keystrokes are reported to the current -- window. Ignoring auto repeated keystrokes is generally done in -- conjunction with using the keyboardMouseCallback. If you do not -- ignore auto repeated keystrokes, your GLUT application will experience -- repeated release/press callbacks. Games using the keyboard will -- typically want to ignore key repeat. perWindowKeyRepeat :: StateVar PerWindowKeyRepeat -- | Execute the joystick callback set by joystickCallback once (if -- one exists). This is done in a synchronous fashion within the current -- context, i.e. when forceJoystickCallback returns, the callback -- will have already happened. forceJoystickCallback :: MonadIO m => m () instance GHC.Show.Show Graphics.UI.GLUT.DeviceControl.PerWindowKeyRepeat instance GHC.Classes.Ord Graphics.UI.GLUT.DeviceControl.PerWindowKeyRepeat instance GHC.Classes.Eq Graphics.UI.GLUT.DeviceControl.PerWindowKeyRepeat instance GHC.Show.Show Graphics.UI.GLUT.DeviceControl.GlobalKeyRepeat instance GHC.Classes.Ord Graphics.UI.GLUT.DeviceControl.GlobalKeyRepeat instance GHC.Classes.Eq Graphics.UI.GLUT.DeviceControl.GlobalKeyRepeat -- | This module contains a simple utility routine to report any pending GL -- errors. module Graphics.UI.GLUT.Debugging -- | Report any pending GL errors to stderr (which is typically the -- console). If there are no pending errors, this routine does nothing. -- Note that the error flags are reset after this action, i.e. there are -- no pending errors left afterwards. reportErrors :: MonadIO m => m () -- | OpenGL supports both RGBA and color index rendering. The RGBA mode is -- generally preferable to color index because more OpenGL rendering -- capabilities are available and color index mode requires the loading -- of colormap entries. -- -- The GLUT color index state variables are used to read and write -- entries in a window's color index colormap. Every GLUT color index -- window has its own logical color index colormap. The size of a -- window's colormap can be determined by reading -- numColorMapEntries. -- -- GLUT color index windows within a program can attempt to share -- colormap resources by copying a single color index colormap to -- multiple windows using copyColormap. If possible GLUT will -- attempt to share the actual colormap. While copying colormaps using -- copyColormap can potentially allow sharing of physical colormap -- resources, logically each window has its own colormap. So changing a -- copied colormap of a window will force the duplication of the -- colormap. For this reason, color index programs should generally load -- a single color index colormap, copy it to all color index windows -- within the program, and then not modify any colormap cells. -- -- Use of multiple colormaps is likely to result in colormap installation -- problems where some windows are displayed with an incorrect colormap -- due to limitations on colormap resources. module Graphics.UI.GLUT.Colormap -- | Controls the color index colormap entry of the current window's -- logical colormap for the layer in use. The layer in use -- of the current window should be a color index window. The color -- index should be zero or greater and less than the total number of -- colormap entries for the window (see numColorMapEntries) and -- different from an overlay's transparent index (see -- transparentIndex). -- -- If the layer in use's colormap was copied by reference, setting -- a colormap entry will force the duplication of the colormap. colorMapEntry :: Index1 GLint -> StateVar (Color3 GLfloat) -- | Copy (lazily if possible to promote sharing) the logical colormap from -- a specified window to the current window's layer in use. -- The copy will be from the normal plane to the normal plane; or from -- the overlay to the overlay (never across different layers). Once a -- colormap has been copied, avoid setting cells in the colormap via -- colorMapEntry since that will force an actual copy of the -- colormap if it was previously copied by reference. copyColormap -- should only be called when both the current window and the -- specified window are color index windows. copyColormap :: MonadIO m => Window -> m () -- | Contains the number of entries in the colormap of the current -- window's current layer (0 in RGBA mode). numColorMapEntries :: GettableStateVar GLint -- | Contains the transparent color index of the overlay of the current -- window or -1 if no overlay is in use. transparentIndex :: GettableStateVar (Index1 GLint) module Graphics.UI.GLUT.Callbacks.Window -- | A display callback type DisplayCallback = IO () -- | Controls the display callback for the current window. When GLUT -- determines that the normal plane for the window needs to be -- redisplayed, the display callback for the window is called. Before the -- callback, the current window is set to the window needing to be -- redisplayed and (if no overlay display callback is registered) the -- layer in use is set to the normal plane. The entire normal -- plane region should be redisplayed in response to the callback (this -- includes ancillary buffers if your program depends on their state). -- -- GLUT determines when the display callback should be triggered based on -- the window's redisplay state. The redisplay state for a window can be -- either set explicitly by calling postRedisplay or implicitly as -- the result of window damage reported by the window system. Multiple -- posted redisplays for a window are coalesced by GLUT to minimize the -- number of display callbacks called. -- -- When an overlay is established for a window, but there is no overlay -- display callback registered, the display callback is used for -- redisplaying both the overlay and normal plane (that is, it will be -- called if either the redisplay state or overlay redisplay state is -- set). In this case, the layer in use is not implicitly changed -- on entry to the display callback. -- -- See overlayDisplayCallback to understand how distinct callbacks -- for the overlay and normal plane of a window may be established. -- -- When a window is created, no display callback exists for the window. -- It is the responsibility of the programmer to install a display -- callback for the window before the window is shown. A display callback -- must be registered for any window that is shown. If a window becomes -- displayed without a display callback being registered, a fatal error -- occurs. There is no way to "deregister" a display callback (though -- another callback routine can always be registered). -- -- Upon return from the display callback, the normal damaged state of the -- window (see damaged) is cleared. If there is no overlay display -- callback registered the overlay damaged state of the window (see -- damaged) is also cleared. displayCallback :: SettableStateVar DisplayCallback -- | Controls the overlay display callback for the current window. -- The overlay display callback is functionally the same as the window's -- display callback except that the overlay display callback is used to -- redisplay the window's overlay. -- -- When GLUT determines that the overlay plane for the window needs to be -- redisplayed, the overlay display callback for the window is called. -- Before the callback, the current window is set to the window -- needing to be redisplayed and the layer in use is set to the -- overlay. The entire overlay region should be redisplayed in response -- to the callback (this includes ancillary buffers if your program -- depends on their state). -- -- GLUT determines when the overlay display callback should be triggered -- based on the window's overlay redisplay state. The overlay redisplay -- state for a window can be either set explicitly by calling -- postOverlayRedisplay or implicitly as the result of window -- damage reported by the window system. Multiple posted overlay -- redisplays for a window are coalesced by GLUT to minimize the number -- of overlay display callbacks called. -- -- Upon return from the overlay display callback, the overlay damaged -- state of the window (see damaged) is cleared. -- -- Initially there is no overlay display callback registered when an -- overlay is established. See displayCallback to understand how -- the display callback alone is used if an overlay display callback is -- not registered. overlayDisplayCallback :: SettableStateVar (Maybe DisplayCallback) -- | A reshape callback type ReshapeCallback = Size -> IO () -- | Controls the reshape callback for the current window. The -- reshape callback is triggered when a window is reshaped. A reshape -- callback is also triggered immediately before a window's first display -- callback after a window is created or whenever an overlay for the -- window is established. The parameter of the callback specifies the new -- window size in pixels. Before the callback, the current window -- is set to the window that has been reshaped. -- -- If a reshape callback is not registered for a window or -- reshapeCallback is set to Nothing (to deregister a -- previously registered callback), the default reshape callback is used. -- This default callback will simply call -- --
--   viewport (Position 0 0) (Size width height)
--   
-- -- on the normal plane (and on the overlay if one exists). -- -- If an overlay is established for the window, a single reshape callback -- is generated. It is the callback's responsibility to update both the -- normal plane and overlay for the window (changing the layer in use as -- necessary). -- -- When a top-level window is reshaped, subwindows are not reshaped. It -- is up to the GLUT program to manage the size and positions of -- subwindows within a top-level window. Still, reshape callbacks will be -- triggered for subwindows when their size is changed using -- windowSize. reshapeCallback :: SettableStateVar (Maybe ReshapeCallback) -- | A position callback type PositionCallback = Position -> IO () -- | (freeglut only) Controls the position callback for the -- current window. The position callback for a window is called -- when the position of a window changes. positionCallback :: SettableStateVar (Maybe PositionCallback) -- | The visibility state of the current window data Visibility -- | No part of the current window is visible, i.e., until the -- window's visibility changes, all further rendering to the window is -- discarded. NotVisible :: Visibility -- | The current window is totally or partially visible. GLUT -- considers a window visible if any pixel of the window is visible or -- any pixel of any descendant window is visible on the screen. Visible :: Visibility -- | A visibility callback type VisibilityCallback = Visibility -> IO () -- | Controls the visibility callback for the current window. The -- visibility callback for a window is called when the visibility of a -- window changes. -- -- If the visibility callback for a window is disabled and later -- re-enabled, the visibility status of the window is undefined; any -- change in window visibility will be reported, that is if you disable a -- visibility callback and re-enable the callback, you are guaranteed the -- next visibility change will be reported. -- -- Note that you can either use visibilityCallback or -- windowStateCallback, but not both, because the former is -- implemented via the latter. visibilityCallback :: SettableStateVar (Maybe VisibilityCallback) -- | The window state of the current window data WindowState -- | The current window is unmapped. Unmapped :: WindowState -- | The current window is unobscured. FullyRetained :: WindowState -- | The current window is partially obscured. PartiallyRetained :: WindowState -- | The current window is fully obscured. FullyCovered :: WindowState -- | A window state callback type WindowStateCallback = WindowState -> IO () -- | Controls the window state callback for the current window. The -- window state callback for a window is called when the window state of -- a window changes. -- -- If the window state callback for a window is disabled and later -- re-enabled, the window state state of the window is undefined; any -- change in the window state will be reported, that is if you disable a -- window state callback and re-enable the callback, you are guaranteed -- the next window state change will be reported. -- -- Note that you can either use visibilityCallback or -- windowStateCallback, but not both, because the former is -- implemented via the latter. windowStateCallback :: SettableStateVar (Maybe WindowStateCallback) -- | A window close callback type CloseCallback = IO () -- | Controls the window close callback for the current window. closeCallback :: SettableStateVar (Maybe CloseCallback) -- | An initialize context callback type InitContextCallback = IO () -- | (freeglut only) Controls the initialize context callback for -- the /current window/. initContextCallback :: SettableStateVar (Maybe InitContextCallback) -- | The application status of the current window data AppStatus AppStatusPause :: AppStatus AppStatusResume :: AppStatus -- | An application status callback type AppStatusCallback = AppStatus -> IO () -- | Controls the application status callback for the current -- window. appStatusCallback :: SettableStateVar (Maybe AppStatusCallback) -- | A keyboard callback type KeyboardCallback = Char -> Position -> IO () -- | Controls the keyboard callback for the current window. This is -- activated only when a key is pressed. keyboardCallback :: SettableStateVar (Maybe KeyboardCallback) -- | Controls the keyboard callback for the current window. This is -- activated only when a key is released. keyboardUpCallback :: SettableStateVar (Maybe KeyboardCallback) -- | A special key callback type SpecialCallback = SpecialKey -> Position -> IO () -- | Controls the special key callback for the current window. This -- is activated only when a special key is pressed. specialCallback :: SettableStateVar (Maybe SpecialCallback) -- | Controls the special key callback for the current window. This -- is activated only when a special key is released. specialUpCallback :: SettableStateVar (Maybe SpecialCallback) -- | A mouse callback type MouseCallback = MouseButton -> KeyState -> Position -> IO () -- | Controls the mouse callback for the current window. mouseCallback :: SettableStateVar (Maybe MouseCallback) -- | A generalized view of keys data Key Char :: Char -> Key SpecialKey :: SpecialKey -> Key MouseButton :: MouseButton -> Key -- | Special keys data SpecialKey KeyF1 :: SpecialKey KeyF2 :: SpecialKey KeyF3 :: SpecialKey KeyF4 :: SpecialKey KeyF5 :: SpecialKey KeyF6 :: SpecialKey KeyF7 :: SpecialKey KeyF8 :: SpecialKey KeyF9 :: SpecialKey KeyF10 :: SpecialKey KeyF11 :: SpecialKey KeyF12 :: SpecialKey KeyLeft :: SpecialKey KeyUp :: SpecialKey KeyRight :: SpecialKey KeyDown :: SpecialKey KeyPageUp :: SpecialKey KeyPageDown :: SpecialKey KeyHome :: SpecialKey KeyEnd :: SpecialKey KeyInsert :: SpecialKey KeyNumLock :: SpecialKey KeyBegin :: SpecialKey KeyDelete :: SpecialKey KeyShiftL :: SpecialKey KeyShiftR :: SpecialKey KeyCtrlL :: SpecialKey KeyCtrlR :: SpecialKey KeyAltL :: SpecialKey KeyAltR :: SpecialKey -- | You should actually never encounter this value, it is just here as a -- safeguard against future changes in the native GLUT library. KeyUnknown :: Int -> SpecialKey -- | Mouse buttons, including a wheel data MouseButton LeftButton :: MouseButton MiddleButton :: MouseButton RightButton :: MouseButton WheelUp :: MouseButton WheelDown :: MouseButton AdditionalButton :: Int -> MouseButton -- | The current state of a key or button data KeyState Down :: KeyState Up :: KeyState -- | The state of the keyboard modifiers data Modifiers Modifiers :: KeyState -> Modifiers [shift, ctrl, alt] :: Modifiers -> KeyState -- | A keyboard/mouse callback type KeyboardMouseCallback = Key -> KeyState -> Modifiers -> Position -> IO () -- | Controls the keyboard/mouse callback for the current window. -- The keyboard/mouse callback for a window is called when the state of a -- key or mouse button changes. The callback parameters indicate the new -- state of the key/button, the state of the keyboard modifiers, and the -- mouse location in window relative coordinates. -- -- Note that this is a convenience function that should not ordinarily be -- used in conjunction with keyboardCallback, -- keyboardUpCallback, specialCallback, -- specialUpCallback, or mouseCallback. keyboardMouseCallback :: SettableStateVar (Maybe KeyboardMouseCallback) type WheelNumber = Int type WheelDirection = Int type MouseWheelCallback = WheelNumber -> WheelDirection -> Position -> IO () -- | (freeglut only) Controls the mouse wheel callback for the -- current window. The mouse wheel callback for a window is called -- when a mouse wheel is used and the wheel number is greater than or -- equal to numMouseButtons. mouseWheelCallback :: SettableStateVar (Maybe MouseWheelCallback) -- | A motion callback type MotionCallback = Position -> IO () -- | Controls the motion callback for the current window. The motion -- callback for a window is called when the mouse moves within the window -- while one or more mouse buttons are pressed. The callback parameter -- indicates the mouse location in window relative coordinates. motionCallback :: SettableStateVar (Maybe MotionCallback) -- | Controls the passive motion callback for the current window. -- The passive motion callback for a window is called when the mouse -- moves within the window while no mouse buttons are pressed. The -- callback parameter indicates the mouse location in window relative -- coordinates. passiveMotionCallback :: SettableStateVar (Maybe MotionCallback) -- | The relation between the mouse pointer and the current window -- has changed. data Crossing -- | The mouse pointer has left the current window. WindowLeft :: Crossing -- | The mouse pointer has entered the current window. WindowEntered :: Crossing -- | An enter/leave callback type CrossingCallback = Crossing -> IO () -- | Controls the mouse enter/leave callback for the current window. -- Note that some window systems may not generate accurate enter/leave -- callbacks. -- -- X Implementation Notes: An X implementation of GLUT should -- generate accurate enter/leave callbacks. crossingCallback :: SettableStateVar (Maybe CrossingCallback) -- | Translation of the Spaceball along one axis, normalized to be in the -- range of -1000 to +1000 inclusive type SpaceballMotion = Int -- | Rotation of the Spaceball along one axis, normalized to be in the -- range of -1800 .. +1800 inclusive type SpaceballRotation = Int -- | The index of a specific buttons of an input device. type ButtonIndex = Int -- | The state of the Spaceball has changed. data SpaceballInput SpaceballMotion :: SpaceballMotion -> SpaceballMotion -> SpaceballMotion -> SpaceballInput SpaceballRotation :: SpaceballRotation -> SpaceballRotation -> SpaceballRotation -> SpaceballInput SpaceballButton :: ButtonIndex -> KeyState -> SpaceballInput -- | A SpaceballButton callback type SpaceballCallback = SpaceballInput -> IO () -- | Controls the Spaceball callback for the current window. The -- Spaceball callback for a window is called when the window has -- Spaceball input focus (normally, when the mouse is in the window) and -- the user generates Spaceball translations, rotations, or button -- presses. The number of available Spaceball buttons can be determined -- with numSpaceballButtons. -- -- Registering a Spaceball callback when a Spaceball device is not -- available has no effect and is not an error. In this case, no -- Spaceball callbacks will be generated. spaceballCallback :: SettableStateVar (Maybe SpaceballCallback) -- | The dial & button box state has changed. data DialAndButtonBoxInput DialAndButtonBoxButton :: ButtonIndex -> KeyState -> DialAndButtonBoxInput DialAndButtonBoxDial :: DialIndex -> Int -> DialAndButtonBoxInput -- | The index of a specific dial of a dial and button box. type DialIndex = Int -- | A dial & button box callback type DialAndButtonBoxCallback = DialAndButtonBoxInput -> IO () -- | Controls the dial & button box callback for the current -- window. The dial & button box button callback for a window is -- called when the window has dial & button box input focus -- (normally, when the mouse is in the window) and the user generates -- dial & button box button presses or dial changes. The number of -- available dial & button box buttons and dials can be determined -- with numDialsAndButtons. -- -- Registering a dial & button box callback when a dial & button -- box device is not available is ineffectual and not an error. In this -- case, no dial & button box button will be generated. dialAndButtonBoxCallback :: SettableStateVar (Maybe DialAndButtonBoxCallback) -- | Absolute tablet position, with coordinates normalized to be in the -- range of 0 to 2000 inclusive data TabletPosition TabletPosition :: Int -> Int -> TabletPosition -- | The table state has changed. data TabletInput TabletMotion :: TabletInput TabletButton :: ButtonIndex -> KeyState -> TabletInput -- | A tablet callback type TabletCallback = TabletInput -> TabletPosition -> IO () -- | Controls the tablet callback for the current window. The tablet -- callback for a window is called when the window has tablet input focus -- (normally, when the mouse is in the window) and the user generates -- tablet motion or button presses. The number of available tablet -- buttons can be determined with numTabletButtons. -- -- Registering a tablet callback when a tablet device is not available is -- ineffectual and not an error. In this case, no tablet callbacks will -- be generated. tabletCallback :: SettableStateVar (Maybe TabletCallback) -- | The state of the joystick buttons data JoystickButtons JoystickButtons :: KeyState -> JoystickButtons [joystickButtonA, joystickButtonB, joystickButtonC, joystickButtonD] :: JoystickButtons -> KeyState -- | Absolute joystick position, with coordinates normalized to be in the -- range of -1000 to 1000 inclusive. The signs of the three axes mean the -- following: -- -- data JoystickPosition JoystickPosition :: Int -> Int -> Int -> JoystickPosition -- | A joystick callback type JoystickCallback = JoystickButtons -> JoystickPosition -> IO () -- | Controls the joystick callback for the current window. The -- joystick callback is called either due to polling of the joystick at -- the uniform timer interval specified (if > 0) or in response to an -- explicit call of forceJoystickCallback. -- -- X Implementation Notes: Currently GLUT has no joystick support -- for X11. joystickCallback :: SettableStateVar (Maybe (JoystickCallback, PollRate)) -- | A description where the multi-touch event is coming from, the freeglut -- specs are very vague about the actual semantics. It contains the -- device ID and/or the cursor/finger ID. type TouchID = Int -- | A multi-touch variant of MouseCallback. type MultiMouseCallback = TouchID -> MouseCallback -- | (freeglut only) A multi-touch variant of mouseCallback. multiMouseCallback :: SettableStateVar (Maybe MultiMouseCallback) -- | A multi-touch variant of CrossingCallback. type MultiCrossingCallback = TouchID -> CrossingCallback -- | (freeglut only) A multi-touch variant of -- crossingCallback. multiCrossingCallback :: SettableStateVar (Maybe MultiCrossingCallback) -- | A multi-touch variant of MotionCallback. type MultiMotionCallback = TouchID -> MotionCallback -- | (freeglut only) A multi-touch variant of motionCallback. multiMotionCallback :: SettableStateVar (Maybe MultiMotionCallback) -- | (freeglut only) A multi-touch variant of -- passiveMotionCallback. multiPassiveMotionCallback :: SettableStateVar (Maybe MultiMotionCallback) instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Window.JoystickPosition instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Window.JoystickPosition instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Window.JoystickPosition instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Window.JoystickButtons instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Window.JoystickButtons instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Window.JoystickButtons instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Window.TabletInput instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Window.TabletInput instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Window.TabletInput instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Window.TabletPosition instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Window.TabletPosition instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Window.TabletPosition instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Window.DialAndButtonBoxInput instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Window.DialAndButtonBoxInput instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Window.DialAndButtonBoxInput instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Window.SpaceballInput instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Window.SpaceballInput instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Window.SpaceballInput instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Window.Crossing instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Window.Crossing instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Window.Crossing instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Window.Key instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Window.Key instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Window.Key instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Window.Modifiers instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Window.Modifiers instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Window.Modifiers instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Window.KeyState instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Window.KeyState instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Window.KeyState instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Window.SpecialKey instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Window.SpecialKey instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Window.SpecialKey instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Window.AppStatus instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Window.AppStatus instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Window.AppStatus instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Window.WindowState instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Window.WindowState instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Window.WindowState instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Window.Visibility instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Window.Visibility instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Window.Visibility -- | GLUT supports simple cascading pop-up menus. They are designed to let -- a user select various modes within a program. The functionality is -- simple and minimalistic and is meant to be that way. Do not mistake -- GLUT's pop-up menu facility with an attempt to create a full-featured -- user interface. module Graphics.UI.GLUT.Menu -- | A menu is simply a list of menu items, possibly with an associated -- font. data Menu Menu :: [MenuItem] -> Menu MenuWithFont :: BitmapFont -> [MenuItem] -> Menu -- | A single item within a menu can either be a plain menu entry or a -- sub-menu entry, allowing for arbitrarily deep nested menus. data MenuItem -- | A plain menu entry with an associated callback, which is triggered -- when the user selects the entry MenuEntry :: String -> MenuCallback -> MenuItem -- | A sub-menu, which is cascaded when the user selects the entry, -- allowing sub-menu entries to be selected SubMenu :: String -> Menu -> MenuItem type MenuCallback = IO () -- | Create a new pop-up menu for the current window, attaching it -- to the given mouse button. A previously attached menu (if any), is -- detached before and won't receive callbacks anymore. -- -- It is illegal to call attachMenu while any (sub-)menu is in -- use, i.e. popped up. -- -- X Implementation Notes: If available, GLUT for X will take -- advantage of overlay planes for implementing pop-up menus. The use of -- overlay planes can eliminate display callbacks when pop-up menus are -- deactivated. The SERVER_OVERLAY_VISUALS convention is used to -- determine if overlay visuals are available. attachMenu :: MonadIO m => MouseButton -> Menu -> m () -- | Contains the number of menu items in the current menu. numMenuItems :: GettableStateVar Int instance GHC.Classes.Ord Graphics.UI.GLUT.Menu.MenuHook instance GHC.Classes.Eq Graphics.UI.GLUT.Menu.MenuHook module Graphics.UI.GLUT.Callbacks.Global data MenuUsage NotInUse :: MenuUsage InUse :: MenuUsage type MenuStatusCallback = MenuUsage -> Position -> IO () -- | Controls the global menu status callback so a GLUT program can -- determine when a menu is in use or not. When a menu status callback is -- registered, it will be called with the value InUse when pop-up -- menus are in use by the user; and the callback will be called with the -- value NotInUse when pop-up menus are no longer in use. -- Additionally, the location in window coordinates of the button press -- that caused the menu to go into use, or the location where the menu -- was released (maybe outside the window). Other callbacks continue to -- operate (except mouse motion callbacks) when pop-up menus are in use -- so the menu status callback allows a program to suspend animation or -- other tasks when menus are in use. The cascading and unmapping of -- sub-menus from an initial pop-up menu does not generate menu status -- callbacks. There is a single menu status callback for GLUT. -- -- When the menu status callback is called, the current menu will -- be set to the initial pop-up menu in both the InUse and -- NotInUse cases. The current window will be set to the -- window from which the initial menu was popped up from, also in both -- cases. menuStatusCallback :: SettableStateVar (Maybe MenuStatusCallback) type IdleCallback = IO () -- | Controls the global idle callback so a GLUT program can perform -- background processing tasks or continuous animation when window system -- events are not being received. If enabled, the idle callback is -- continuously called when events are not being received. The current -- window and current menu will not be changed before the idle -- callback. Programs with multiple windows and/or menus should -- explicitly set the current window and/or /current menu/ and not -- rely on its current setting. -- -- The amount of computation and rendering done in an idle callback -- should be minimized to avoid affecting the program's interactive -- response. In general, not more than a single frame of rendering should -- be done in an idle callback. idleCallback :: SettableStateVar (Maybe IdleCallback) -- | Timeout for the timer callback in milliseconds type Timeout = Int type TimerCallback = IO () -- | Register a one-shot timer callback to be triggered after at least the -- given amount of time. Multiple timer callbacks at same or differing -- times may be registered simultaneously. There is no support for -- canceling a registered callback. -- -- The number of milliseconds is a lower bound on the time before the -- callback is generated. GLUT attempts to deliver the timer callback as -- soon as possible after the expiration of the callback's time interval. addTimerCallback :: Timeout -> TimerCallback -> IO () instance GHC.Show.Show Graphics.UI.GLUT.Callbacks.Global.MenuUsage instance GHC.Classes.Ord Graphics.UI.GLUT.Callbacks.Global.MenuUsage instance GHC.Classes.Eq Graphics.UI.GLUT.Callbacks.Global.MenuUsage -- | GLUT supports a number of callbacks to respond to events. There are -- three types of callbacks: window, menu, and global. Window callbacks -- indicate when to redisplay or reshape a window, when the visibility of -- the window changes, and when input is available for the window. Menu -- callbacks are described in Graphics.UI.GLUT.Menu. The global -- callbacks manage the passing of time and menu usage. The calling order -- of callbacks between different windows is undefined. -- -- Callbacks for input events should be delivered to the window the event -- occurs in. Events should not propagate to parent windows. -- -- A callback of type Foo can registered by setting -- fooCallback to Just the callback. Almost all callbacks -- can be de-registered by setting the corresponding fooCallback -- to Nothing, the only exceptions being DisplayCallback -- (can only be re-registered) and TimerCallback (can't be -- unregistered). -- -- X Implementation Notes: The X GLUT implementation uses the X -- Input extension to support sophisticated input devices: Spaceball, -- dial & button box, and digitizing tablet. Because the X Input -- extension does not mandate how particular types of devices are -- advertised through the extension, it is possible GLUT for X may not -- correctly support input devices that would otherwise be of the correct -- type. The X GLUT implementation will support the Silicon Graphics -- Spaceball, dial & button box, and digitizing tablet as advertised -- through the X Input extension. module Graphics.UI.GLUT.Callbacks -- | After a GLUT program has done initial setup such as creating windows -- and menus, GLUT programs enter the GLUT event processing loop by -- calling mainLoop or handle events iteratively with -- mainLoopEvent. module Graphics.UI.GLUT.Begin -- | Enter the GLUT event processing loop; it will call as necessary any -- callbacks that have been registered. This routine should be called at -- most once in a GLUT program. mainLoop :: MonadIO m => m () -- | (freeglut only) Process one iteration's worth of events in its -- event loop. This allows the application to control its own event loop -- and still use the GLUT package. mainLoopEvent :: MonadIO m => m () -- | (freeglut only) Stop the event loop. If -- actionOnWindowClose contains Exit, the application will -- exit; otherwise control will return to the function which called -- mainLoop. -- -- If the application has two nested calls to mainLoop and calls -- leaveMainLoop, the behaviour is undefined. It may leave only -- the inner nested loop or it may leave both loops. If the reader has a -- strong preference for one behaviour over the other he should contact -- the freeglut Programming Consortium and ask for the code to be fixed. leaveMainLoop :: MonadIO m => m () -- | The behaviour when the user closes a window. data ActionOnWindowClose -- | Exit the whole program when any window is closed or -- leaveMainLoop is called (default). Exit :: ActionOnWindowClose -- | Return from mainLoop when any window is closed. MainLoopReturns :: ActionOnWindowClose -- | Return from mainLoop after the last window is closed. ContinueExecution :: ActionOnWindowClose -- | (freeglut only) Controls the behaviour when the user closes a -- window. actionOnWindowClose :: StateVar ActionOnWindowClose instance GHC.Show.Show Graphics.UI.GLUT.Begin.ActionOnWindowClose instance GHC.Classes.Ord Graphics.UI.GLUT.Begin.ActionOnWindowClose instance GHC.Classes.Eq Graphics.UI.GLUT.Begin.ActionOnWindowClose -- | A Haskell binding for GLUT, the OpenGL Utility Toolkit, a window -- system independent toolkit for writing OpenGL programs. It includes -- support for the extended functionality available in freeglut (see -- http://freeglut.sourceforge.net/) and OpenGLUT (see -- http://openglut.sourceforge.net/), too. module Graphics.UI.GLUT