Module shader

shader: Friendly wrapper for OpenGL GLSL shaders

Class shader

shader:vertex (code) Add another chunk of GLSL code to the vertex shader:
shader:fragment (code) Add another chunk of GLSL code to the fragment shader:
shader:bind () Bind the shader program (gl.UseProgram) will compile/link the shader if required will throw an error of shader fails to compile/link
shader:unbind () Stop using this shader program (gl.UseProgram(0))
shader:context_destroy () Release the shader program (it will be recreated when next used)
shader:GetAttribLocation (k) Get the attribute location (GLuint) for a shader attribute
shader:uniform (k, ...) Set a shader uniform
shader:attribute (k, ...) Set a shader attribute


Class shader

A shader program
shader:vertex (code)
Add another chunk of GLSL code to the vertex shader:

Parameters:

Returns:

    shader self
shader:fragment (code)
Add another chunk of GLSL code to the fragment shader:

Parameters:

Returns:

    shader self
shader:bind ()
Bind the shader program (gl.UseProgram) will compile/link the shader if required will throw an error of shader fails to compile/link

Returns:

    shader self
shader:unbind ()
Stop using this shader program (gl.UseProgram(0))

Returns:

    shader self
shader:context_destroy ()
Release the shader program (it will be recreated when next used)

Returns:

    shader self
shader:GetAttribLocation (k)
Get the attribute location (GLuint) for a shader attribute

Parameters:

Returns:

    GLuint attribute location
shader:uniform (k, ...)
Set a shader uniform

Parameters:

  • k string uniform name
  • ... uniform values (numbers)

Returns:

    shader self
shader:attribute (k, ...)
Set a shader attribute

Parameters:

  • k string attribute name
  • ... attribute values (numbers)

Returns:

    shader self
generated by LDoc 1.3.12