gelatin-gl-0.1.0.0: OpenGL rendering routines for the gelatin-picture graphics EDSL.

Safe HaskellNone
LanguageHaskell2010

Gelatin.GL.Renderer

Contents

Synopsis

Renderer

data Context Source #

Constructors

Context 

Loading and using textures

bindTexsAround :: MonadIO m => [GLuint] -> m a -> m a Source #

Binds the given textures to GL_TEXTURE0, GL_TEXTURE1, ... in ascending order of the texture unit, runs the IO action and then unbinds the textures.

bindTexAround :: MonadIO m => GLuint -> m a -> m a Source #

Line rendering

colorPolylineRenderer :: Context -> Simple2DShader -> Float -> Float -> (LineCap, LineCap) -> Vector (V2 Float) -> Vector (V4 Float) -> IO Renderer2 Source #

Creates and returns a renderer that renders a colored, expanded 2d polyline projected in 2d space.

texPolylineRenderer :: Context -> Simple2DShader -> Float -> Float -> (LineCap, LineCap) -> Vector (V2 Float) -> Vector (V2 Float) -> IO Renderer2 Source #

Creates and returns a renderer that renders a textured, expanded 2d polyline projected in 2d space.

Triangle rendering

colorRenderer :: Context -> Simple2DShader -> GLuint -> Vector (V2 Float) -> Vector (V4 Float) -> IO Renderer2 Source #

Creates and returns a renderer that renders the given colored geometry.

textureRenderer :: Context -> Simple2DShader -> GLuint -> Vector (V2 Float) -> Vector (V2 Float) -> IO Renderer2 Source #

Creates and returns a renderer that renders a textured geometry.

Bezier rendering

colorBezRenderer :: Context -> Simple2DShader -> Vector (V2 Float) -> Vector (V4 Float) -> IO Renderer2 Source #

Creates and returns a renderer that renders the given colored beziers.

textureBezRenderer :: Context -> Simple2DShader -> Vector (V2 Float) -> Vector (V2 Float) -> IO Renderer2 Source #

Creates and returns a renderer that renders the given textured beziers.

Masking

maskRenderer :: Context -> Simple2DShader -> GLuint -> Vector (V2 Float) -> Vector (V2 Float) -> IO Renderer2 Source #

Creates and returns a renderer that masks a textured rectangular area with another texture.

stencilMask :: IO () -> IO () -> IO () Source #

Creates an IO () drawing computation that masks an IO () drawing computation with another using a stencil test.

alphaMask :: Context -> Simple2DShader -> IO () -> IO () -> IO Renderer2 Source #

Creates a rendering that masks an IO () drawing computation with the alpha value of another.

Transforming a rendering

Utils

clipTexture :: GLuint -> ClippingArea -> IO GLuint Source #

Sub-samples a texture using the given coordinate box and creates a new texture. Keep in mind that OpenGL texture coordinates are flipped from normal graphics coordinates (y = 0 is the bottom of the texture). That fact has bitten the author a number of times while clipping a texture created with toTexture and toUnitTexture.