luminance-0.8.1: Type-safe, type-level and stateless graphics framework

Copyright(C) 2015 Dimitri Sabadie
LicenseBSD3
MaintainerDimitri Sabadie <dimitri.sabadie@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Graphics.Luminance.Framebuffer

Contents

Description

 

Synopsis

Framebuffer creation

data Framebuffer rw c d

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 ()

Framebuffer with the depth buffer muted.

type DepthFramebuffer rw d = Framebuffer rw () d

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)

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

Typeclass of possible framebuffer color attachments.

Minimal complete definition

addColorOutput

class FramebufferDepthAttachment d

Typeclass of possible framebuffer depth attachments.

Minimal complete definition

addDepthOutput

Framebuffer access

class FramebufferColorRW rw

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

Minimal complete definition

setFramebufferColorRW

class FramebufferTarget rw

Framebuffer representation of R, W and RW.

Minimal complete definition

framebufferTarget

Framebuffer outputs

type family TexturizeFormat a :: *

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

data Output c d

Framebuffer output.

Constructors

Output (TexturizeFormat c) (TexturizeFormat d) 

Blitting

data FramebufferBlitMask

Mask for framebuffer blit operation.

Constructors

BlitColor 
BlitDepth 
BlitBoth 

Special framebuffers

defaultFramebuffer :: Framebuffer RW () ()

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

Framebuffer errors