luminance-0.6: Type-safe, dependently-typed and stateless graphics framework

Copyright(C) 2015 Dimitri Sabadie
MaintainerDimitri Sabadie <>
Safe HaskellNone






Framebuffer creation

data Framebuffer rw c d Source

A Framebuffer represents two buffers: a color buffer and depth buffer. You can select which one you want and specify the formats to use by providing Pixel types. If you want to mute a buffer, use '()'.

type ColorFramebuffer rw c = Framebuffer rw c () Source

Framebuffer with the depth buffer muted.

type DepthFramebuffer rw d = Framebuffer rw () d Source

Framebuffer with the color buffer muted. Can be used to implement fast pre-passes.

createFramebuffer :: forall c d e m rw. (HasFramebufferError e, MonadError e m, MonadIO m, MonadResource m, FramebufferColorAttachment c, FramebufferColorRW rw, FramebufferDepthAttachment d, FramebufferTarget rw) => Natural -> Natural -> Natural -> m (Framebuffer rw c d) Source

createFramebuffer w h mipmaps creates a new Framebuffer with dimension w * h and allocating spaces for mipmaps level of textures. The textures are created by providing a correct type.

For the color part, you can pass either:

  • '()': that will mute the color buffer of the framebuffer;
  • Format t c: that will create a single texture with the wished color format;
  • or a :. b: that will create a chain of textures; a and b cannot be '()'.

For the depth part, you can pass either:

  • '()': that will mute the depth buffer of the framebuffer;
  • Format t c: that will create a single texture with the wished depth format.

Finally, the rw parameter can be set to R, W or RW to specify which kind of framebuffer access you’ll need.

Framebuffer attachments

class FramebufferColorAttachment c Source

Typeclass of possible framebuffer color attachments.

Minimal complete definition


class FramebufferDepthAttachment d Source

Typeclass of possible framebuffer depth attachments.

Minimal complete definition


Framebuffer access

class FramebufferColorRW rw Source

Typeclass used to implement read/write operation per color attachment.

Minimal complete definition


class FramebufferTarget rw Source

Framebuffer representation of R, W and RW.

Minimal complete definition


Framebuffer outputs

type family TexturizeFormat a :: * Source

Given a Format, inject it into a Texture2D to handle it.

data Output c d Source

Framebuffer output.


Output (TexturizeFormat c) (TexturizeFormat d) 


data FramebufferBlitMask Source

Mask for framebuffer blit operation.



Special framebuffers

defaultFramebuffer :: Framebuffer RW () () Source

The default Framebuffer represents the screen (back buffer with double buffering).

Framebuffer errors