lowgl-0.3.1.1: Basic gl wrapper and reference

Safe HaskellNone
LanguageHaskell2010

Graphics.GL.Low.VertexAttrib

Synopsis

Documentation

To feed vertices into the vertex shader, the layout of a vertex must be specified in the current VAO for the current shader program. Make a list of LayoutElements and use setVertexLayout on it as seen below.

setVertexLayout
  [ Attrib "position"  3 GLFloat   -- first 12 bytes maps to: in vec3 position;
  , Attrib "shininess" 1 GLFloat   -- next 4 bytes maps to:   in float shininess;
  , Attrib "texcoord"  2 GLFloat   -- next 8 bytes maps to:   in vec2 texcoord;
  , Unused 2                       -- next 2 bytes ignored
  , Attrib "seed"      1 GLShort ] -- next 2 bytes read as 16-bit signed int
                                   --   and mapped to: in float seed;

In this example four mappings from the current VBO to the variables in the current Program will be established in the current VAO.

setVertexLayout :: [VertexLayout] -> IO () Source

This configures the currently bound VAO. It calls glVertexAttribPointer and glEnableVertexAttribArray.

data VertexLayout Source

The name of a vertex input to a program combined with the component format and number of components for that attribute in the vertex data. Alternatively the size of an unused section of the data in bytes.

Constructors

Attrib String Int DataType

Name, component count and component format of a vertex attribute.

Unused Int

Size in bytes of an unused section of the vertex data.

Instances

data DataType Source

The size and interpretation of a vertex attribute component.

Constructors

GLFloat

4-byte float

GLByte

signed byte

GLUnsignedByte

unsigned byte

GLShort

2-byte signed integer

GLUnsignedShort

2-byte unsigned integer

GLInt

4-byte signed integer

GLUnsignedInt

4-byte unsigned integer