vinyl-gl-0.2.0.1: 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 (PlainFieldRec rs), BufferSource (v (PlainFieldRec rs))) => v (PlainFieldRec 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 (PlainFieldRec rs) => BufferedVertices rs -> Vector (PlainFieldRec 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 (PlainFieldRec 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 (PlainFieldRec 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 (PlainFieldRec 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.

newtype BufferedVertices fields Source

Representation of a VBO whose type describes the vertices.

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

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