opengles-0.7.0: OpenGL ES 2.0 and 3.0 with EGL 1.4

Safe HaskellNone
LanguageHaskell2010

Graphics.OpenGLES.Buffer

Contents

Synopsis

Buffer

Constructing Mutable Buffers

data Buffer a Source

type GLArray a = Vector a Source

class (Storable b, b ~ Content a b) => GLSource a b where Source

Methods

makeAref :: a -> GL (Either (GLArray (Content a b)) Int) Source

makeWriter :: a -> (Ptr (Content a b) -> GL (), Int) Source

Instances

Storable b => GLSource Int b 
Storable b => GLSource ByteString b 
Storable a => GLSource [a] a 
Storable a => GLSource (GLArray a) a 
Storable a => GLSource ([a], Int) a 

glLoad :: forall a b. GLSource a b => BufferUsage -> a -> GL (Buffer b) Source

Create and initialize a Buffer storage on GPU working memory.

  • Int → O(1) New Buffer with specified number of elements initialized to zeros.
  • ([a], Int) → O(n) New Buffer made of given list upto n th element.
  • [a] → O(n) New Buffer made of given list. Same as (xs, length xs)
  • ByteStringhead O(1) otherwise O(n) New Buffer from ByteString. Might be copied when necessary.
  • GLArrayUnsafe O(1) Use passed StorableArray as client-side Buffer.
glLoad app2gl (10::Int) :: GL (Buffer Vec4)
glLoad app2gl ([V2 1 1],4::Int) :: GL (Buffer Vec2)
glLoad app2gl uv :: GL (Buffer (V2 Word8))
glLoad app2gl bs :: GL (Buffer Float)
glLoad app2gl (model :: GLArray Model) :: GL (Buffer Model)

glReload :: forall a b. GLSource a b => Buffer b -> Int -> a -> GL () Source

glUnsafeRead :: forall a. Storable a => Buffer a -> (Int, Int) -> GL (GLArray a) Source

glModify :: forall a. Storable a => Buffer a -> Int -> Int -> (GLArray a -> GL ()) -> GL () Source

glMap :: Storable a => (a -> GL a) -> Buffer a -> Int -> Int -> GL () Source

Updating Mutable Buffers

unsafeWithLen :: forall a b. Storable a => GLArray a -> (Int -> Ptr a -> IO b) -> IO b Source

app2gl :: BufferUsage Source

STATIC_DRAW (Default)

gl2app :: BufferUsage Source

STATIC_READ

gl2gl :: BufferUsage Source

STATIC_COPY

gl2glDyn :: BufferUsage Source

DYNAMIC_COPY

Raw Buffer Operations

3+ | GL_OES_mapbuffer glUnmapBufferOES

GL_OES_mapbuffer (*GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); define GL_WRITE_ONLY_OES 0x88B9 | 3+ | GL_EXT_map_buffer_range glMapBufferRangeEXT glFlushMappedBufferRangeEXT

3+ | GL_NV_copy_buffer glCopyBufferSubDataNV

ES 3+

3+ or GL_NV_copy_buffer