record-gl-0.1.0.0: Utilities for working with OpenGL's GLSL shading language and Nikita Volkov's "Record"s.

Safe HaskellNone
LanguageHaskell2010

Graphics.RecordGL.Vertex

Description

Utilities for working with vertex buffer objects (VBOs) filled with vertices represented as Records.

Synopsis

Documentation

bufferVertices :: (Storable rs, BufferSource (v rs)) => v rs -> IO (BufferedVertices rs) Source

Load vertex data into a GPU-accessible buffer.

bindVertices :: BufferedVertices a -> IO () Source

Bind previously-buffered vertex data.

reloadVertices :: Storable rs => BufferedVertices rs -> Vector rs -> IO () Source

Reload BufferedVertices with a Vector of new vertex data.

deleteVertices :: BufferedVertices a -> IO () Source

Delete the object name associated with BufferedVertices

enableVertices :: forall f r. ViableVertex r => ShaderProgram -> f r -> IO (Maybe String) Source

Line up a shader's attribute inputs with a vertex record. This maps vertex fields to GLSL attributes on the basis of record field names on the Haskell side, and variable names on the GLSL side.

enableVertices' :: forall f r. ViableVertex r => ShaderProgram -> f r -> IO () Source

Behaves like enableVertices, but raises an exception if the supplied vertex record does not include a field required by the shader.

enableVertexFields :: forall p r. ViableVertex r => ShaderProgram -> p r -> IO () Source

Bind some of a shader's attribute inputs to a vertex record. This is useful when the inputs of a shader are split across multiple arrays.

fieldToVAD :: forall sy r v a proxy. (Field' sy r (v a), HasFieldNames r, HasFieldSizes r, HasGLType a, Storable r, Num (v a), KnownSymbol sy, Foldable v) => FieldName sy -> r -> VertexArrayDescriptor a Source

Produce a VertexArrayDescriptor for a particular field of a vertex record. fieldToVAD :: forall r v a sy proxy. ( Foldable v) => String -> proxy r -> GL.VertexArrayDescriptor a

type ViableVertex t = (HasFieldNames t, HasFieldSizes t, HasFieldDims t, HasFieldGLTypes t, Storable t) Source

Constraint alias capturing the requirements of a vertex type.

data BufferedVertices a Source

Representation of a VBO whose type describes the vertices.