Module ncine.shader

The table containing shader related functions

Functions

ncine.shader.new () Constructs a shader object.
ncine.shader.delete (shader) Destroys a shader object and releases its memory
ncine.shader.load_from_memory (shader, name, introspection, vertex, fragment) Compiles a shader program after loading shader sources from strings
ncine.shader.load_from_memory_default_vertex (shader, name, introspection, vertex, fragment) Compiles a shader program after loading the fragment shader source from a string.
ncine.shader.load_from_memory_default_fragment (shader, name, introspection, vertex, fragment) Compiles a shader program after loading the vertex shader source from a string.
ncine.shader.load_from_memory_with_hashes (shader, name, introspection, vertex, fragment, vertex_hash, fragment_hash) Compiles a shader program after loading shader sources from strings.
ncine.shader.load_from_file (shader, name, introspection, vertex, fragment) Compiles a shader program after loading shader sources from files
ncine.shader.load_from_file_default_vertex (shader, name, introspection, vertex, fragment) Compiles a shader program after loading the fragment shader source from a file.
ncine.shader.load_from_file_default_fragment (shader, name, introspection, vertex, fragment) Compiles a shader program after loading the vertex shader source from a file.
ncine.shader.set_attribute (shader, attribute, stride, pointer) Sets the VBO stride and pointer for the specified vertex attribute
ncine.shader.is_linked (shader) Returns true if the shader is linked and can therefore be used
ncine.shader.retrieve_infolog_length (shader) Returns the length of the information log including the null termination character
ncine.shader.retrieve_infolog (shader) Retrieves the information log
ncine.shader.get_log_on_errors (shader) Returns the automatic log on errors flag
ncine.shader.set_log_on_errors (shader, should_log) Sets the automatic log on errors flag.
ncine.shader.set_glshaderprogram_label (shader, label) Sets the OpenGL object label for the shader program
ncine.shader.register_batched_shader (shader, batched_shader) Registers a shader to be used for batches of render commands
ncine.shader.is_binary_cache_enabled () Returns true if the binary shader cache is enabled
ncine.shader.set_binary_cache_enabled (enable) Enables or disables the binary shader cache

Tables

shaderObj The light user data of a shader object
ncine.shader_introspection Shader introspection states (enumeration)
ncine.shader_default_vertex Default vertex shaders (enumeration)
ncine.shader_default_fragment Default fragment shaders (enumeration)


Functions

ncine.shader.new ()
Constructs a shader object.

Don’t forget to call ncine.shader.delete when you are done with it!

Returns:

    shaderObj A new shader object
ncine.shader.delete (shader)
Destroys a shader object and releases its memory

Parameters:

  • shader shaderObj The shader object to be destroyed
ncine.shader.load_from_memory (shader, name, introspection, vertex, fragment)
Compiles a shader program after loading shader sources from strings

Parameters:

  • shader shaderObj
  • name string The name of the shader
  • introspection ncine.shader_introspection
  • vertex string The vertex shader GLSL source code
  • fragment string The fragment shader GLSL source code

Returns:

    boolean True if the shader program has been successfully linked
ncine.shader.load_from_memory_default_vertex (shader, name, introspection, vertex, fragment)
Compiles a shader program after loading the fragment shader source from a string.

The vertex shader is a default one, in this case.

Parameters:

  • shader shaderObj
  • name string The name of the shader
  • introspection ncine.shader_introspection
  • vertex ncine.shader_default_vertex The default vertex shader
  • fragment string The fragment shader GLSL source code

Returns:

    boolean True if the shader program has been successfully linked
ncine.shader.load_from_memory_default_fragment (shader, name, introspection, vertex, fragment)
Compiles a shader program after loading the vertex shader source from a string.

The fragment shader is a default one, in this case.

Parameters:

  • shader shaderObj
  • name string The name of the shader
  • introspection ncine.shader_introspection
  • vertex string The vertex shader GLSL source code
  • fragment ncine.shader_default_fragment The default fragment shader

Returns:

    boolean True if the shader program has been successfully linked
ncine.shader.load_from_memory_with_hashes (shader, name, introspection, vertex, fragment, vertex_hash, fragment_hash)
Compiles a shader program after loading shader sources from strings.

In this case custom hashes can be passed to the function.

Parameters:

  • shader shaderObj
  • name string The name of the shader
  • introspection ncine.shader_introspection
  • vertex string The vertex shader GLSL source code
  • fragment string The fragment shader GLSL source code
  • vertex_hash integer
  • fragment_hash integer

Returns:

    boolean True if the shader program has been successfully linked
ncine.shader.load_from_file (shader, name, introspection, vertex, fragment)
Compiles a shader program after loading shader sources from files

Parameters:

  • shader shaderObj
  • name string The name of the shader
  • introspection ncine.shader_introspection
  • vertex string The vertex shader source filename
  • fragment string The fragment shader source filename

Returns:

    boolean True if the shader program has been successfully linked
ncine.shader.load_from_file_default_vertex (shader, name, introspection, vertex, fragment)
Compiles a shader program after loading the fragment shader source from a file.

In this case the vertex shader is a default one.

Parameters:

  • shader shaderObj
  • name string The name of the shader
  • introspection ncine.shader_introspection
  • vertex ncine.shader_default_vertex The default vertex shader
  • fragment string The fragment shader source filename

Returns:

    boolean True if the shader program has been successfully linked
ncine.shader.load_from_file_default_fragment (shader, name, introspection, vertex, fragment)
Compiles a shader program after loading the vertex shader source from a file.

In this case the fragment shader is a default one.

Parameters:

  • shader shaderObj
  • name string The name of the shader
  • introspection ncine.shader_introspection
  • vertex string The vertex shader source filename
  • fragment ncine.shader_default_fragment The default fragment shader

Returns:

    boolean True if the shader program has been successfully linked
ncine.shader.set_attribute (shader, attribute, stride, pointer)
Sets the VBO stride and pointer for the specified vertex attribute

Parameters:

  • shader shaderObj
  • attribute string The name of the vertex attribute
  • stride integer
  • pointer integer

Returns:

    boolean True if the vertex attribute was found
ncine.shader.is_linked (shader)
Returns true if the shader is linked and can therefore be used

Parameters:

Returns:

    boolean
ncine.shader.retrieve_infolog_length (shader)
Returns the length of the information log including the null termination character

Parameters:

Returns:

    integer
ncine.shader.retrieve_infolog (shader)
Retrieves the information log

Parameters:

Returns:

    string
ncine.shader.get_log_on_errors (shader)
Returns the automatic log on errors flag

Parameters:

Returns:

    boolean
ncine.shader.set_log_on_errors (shader, should_log)
Sets the automatic log on errors flag.

If the flag is set to true, the shader will automatically log compilation and linking errors.

Parameters:

ncine.shader.set_glshaderprogram_label (shader, label)
Sets the OpenGL object label for the shader program

Parameters:

ncine.shader.register_batched_shader (shader, batched_shader)
Registers a shader to be used for batches of render commands

Parameters:

ncine.shader.is_binary_cache_enabled ()
Returns true if the binary shader cache is enabled

Returns:

    boolean
ncine.shader.set_binary_cache_enabled (enable)
Enables or disables the binary shader cache

Parameters:

  • enable boolean

Tables

shaderObj
The light user data of a shader object
ncine.shader_introspection
Shader introspection states (enumeration)

Fields:

  • ENABLED
  • NO_UNIFORMS_IN_BLOCKS
  • DISABLED
ncine.shader_default_vertex
Default vertex shaders (enumeration)

Fields:

  • SPRITE
  • SPRITE_NOTEXTURE
  • MESHSPRITE
  • MESHSPRITE_NOTEXTURE
  • TEXTNODE
  • BATCHED_SPRITES
  • BATCHED_SPRITES_NOTEXTURE
  • BATCHED_MESHSPRITES
  • BATCHED_MESHSPRITES_NOTEXTURE
  • BATCHED_TEXTNODES
ncine.shader_default_fragment
Default fragment shaders (enumeration)

Fields:

  • SPRITE
  • SPRITE_GRAY
  • SPRITE_NOTEXTURE
  • TEXTNODE_ALPHA
  • TEXTNODE_RED
generated by LDoc 1.5.0 Last updated 2024-12-18 15:08:56