vinyl-gl-0.3: Utilities for working with OpenGL's GLSL shading language and vinyl records.

Safe HaskellNone
LanguageHaskell2010

Graphics.VinylGL.Vertex

Description

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

Synopsis

Documentation

bufferVertices :: (Storable (FieldRec rs), BufferSource (v (FieldRec rs))) => v (FieldRec 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 (FieldRec rs) => BufferedVertices rs -> Vector (FieldRec 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 rs. ViableVertex (FieldRec rs) => ShaderProgram -> f rs -> 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 rs. ViableVertex (FieldRec rs) => ShaderProgram -> f rs -> 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 rs. ViableVertex (FieldRec rs) => ShaderProgram -> p rs -> 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.

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

Constraint alias capturing the requirements of a vertex type.

newtype BufferedVertices fields Source

Representation of a VBO whose type describes the vertices.

fieldToVAD :: forall sy v a r rs field proxy is. (r ~ `((sy :: Symbol), v a)`, HasFieldNames (FieldRec rs), HasFieldSizes (FieldRec rs), HasGLType a, Storable (FieldRec rs), Num (v a), KnownSymbol sy, Foldable v, RElem r rs is) => field r -> proxy (FieldRec rs) -> VertexArrayDescriptor a Source

Produce a VertexArrayDescriptor for a particular field of a vertex record.