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

Safe HaskellNone

Graphics.VinylGL.Vertex

Description

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

Synopsis

Documentation

bufferVertices :: (Storable (PlainRec rs), BufferSource (v (PlainRec rs))) => v (PlainRec 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 (PlainRec rs) => BufferedVertices rs -> Vector (PlainRec 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 (PlainRec 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 (PlainRec 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 (PlainRec 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. (r ~ (sy ::: v a), HasFieldNames (PlainRec rs), HasFieldSizes (PlainRec rs), HasGLType a, Storable (PlainRec rs), Num (v a), SingI sy, Foldable v, Implicit (Elem r rs)) => r -> Proxy (PlainRec rs) -> VertexArrayDescriptor aSource

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