GLUtil-0.10.4: Miscellaneous OpenGL utilities.
Safe HaskellNone
LanguageHaskell2010

Graphics.GLUtil.Textures

Description

Utilities for loading texture data.

Synopsis

Documentation

data TexColor Source #

Pixel format of image data.

Constructors

TexMono 
TexRG 
TexRGB 
TexBGR 
TexRGBA 

data TexInfo a Source #

A basic texture information record.

Constructors

TexInfo 

texInfo :: Int -> Int -> TexColor -> a -> TexInfo a Source #

Helper for constructing a TexInfo using Haskell Ints for image dimensions.

class HasGLType (Elem a) => IsPixelData a where Source #

Class for containers of texture data.

Associated Types

type Elem a Source #

Methods

withPixels :: a -> (Ptr (Elem a) -> IO c) -> IO c Source #

Instances

Instances details
IsPixelData ByteString Source # 
Instance details

Defined in Graphics.GLUtil.Textures

Associated Types

type Elem ByteString Source #

Methods

withPixels :: ByteString -> (Ptr (Elem ByteString) -> IO c) -> IO c Source #

IsPixelData ShortString Source # 
Instance details

Defined in Graphics.GLUtil.Textures

Associated Types

type Elem ShortString Source #

Methods

withPixels :: ShortString -> (Ptr (Elem ShortString) -> IO c) -> IO c Source #

HasGLType b => IsPixelData [b] Source # 
Instance details

Defined in Graphics.GLUtil.Textures

Associated Types

type Elem [b] Source #

Methods

withPixels :: [b] -> (Ptr (Elem [b]) -> IO c) -> IO c Source #

HasGLType b => IsPixelData (Ptr b) Source # 
Instance details

Defined in Graphics.GLUtil.Textures

Associated Types

type Elem (Ptr b) Source #

Methods

withPixels :: Ptr b -> (Ptr (Elem (Ptr b)) -> IO c) -> IO c Source #

HasGLType b => IsPixelData (Vector b) Source # 
Instance details

Defined in Graphics.GLUtil.Textures

Associated Types

type Elem (Vector b) Source #

Methods

withPixels :: Vector b -> (Ptr (Elem (Vector b)) -> IO c) -> IO c Source #

HasGLType b => IsPixelData (ForeignPtr b) Source # 
Instance details

Defined in Graphics.GLUtil.Textures

Associated Types

type Elem (ForeignPtr b) Source #

Methods

withPixels :: ForeignPtr b -> (Ptr (Elem (ForeignPtr b)) -> IO c) -> IO c Source #

HasGLType b => IsPixelData (StorableArray i b) Source # 
Instance details

Defined in Graphics.GLUtil.Textures

Associated Types

type Elem (StorableArray i b) Source #

Methods

withPixels :: StorableArray i b -> (Ptr (Elem (StorableArray i b)) -> IO c) -> IO c Source #

newtype ShortString Source #

Wrapper whose IsPixelData instance treats the pointer underlying a ByteString as an array of Word16s.

Constructors

ShortString ByteString 

Instances

Instances details
IsPixelData ShortString Source # 
Instance details

Defined in Graphics.GLUtil.Textures

Associated Types

type Elem ShortString Source #

Methods

withPixels :: ShortString -> (Ptr (Elem ShortString) -> IO c) -> IO c Source #

type Elem ShortString Source # 
Instance details

Defined in Graphics.GLUtil.Textures

freshTexture :: forall a proxy. HasGLType a => Int -> Int -> TexColor -> proxy a -> IO TextureObject Source #

Create a new 2D texture with uninitialized contents.

freshTextureWord8 :: Int -> Int -> TexColor -> IO TextureObject Source #

Create a new 2D texture with uninitialized Word8 contents.

freshTextureFloat :: Int -> Int -> TexColor -> IO TextureObject Source #

Create a new 2D texture with uninitialized GLfloat contents.

loadTexture :: IsPixelData a => TexInfo a -> IO TextureObject Source #

Create a new 2D texture with data from a TexInfo.

reloadTexture :: forall a. IsPixelData a => TextureObject -> TexInfo a -> IO () Source #

Replace a 2D texture's pixel data with data from a TexInfo.

texture2DWrap :: StateVar (Repetition, Clamping) Source #

Set texture coordinate wrapping options for both the S and T dimensions of a 2D texture.

texture3DWrap :: StateVar (Repetition, Clamping) Source #

Set texture coordinate wrapping options for the S, T, and R dimensions of a 3D texture.

withTextures :: BindableTextureTarget t => t -> [TextureObject] -> IO a -> IO a Source #

Bind each of the given textures to successive texture units at the given TextureTarget starting with texture unit 0.

withTextures2D :: [TextureObject] -> IO a -> IO a Source #

Bind each of the given 2D textures to successive texture units starting with texture unit 0.

withTexturesAt :: BindableTextureTarget t => t -> [(TextureObject, GLuint)] -> IO a -> IO a Source #

Bind each of the given textures to the texture unit they are paired with. The given action is run with these bindings, then the texture bindings are reset. If you don't care which texture units are used, consider using withTextures or withTextures2D.