Shaders and Gideros

Gideros internally uses five distinct shaders:

  • The ‘Basic’ shader handle shapes with a constant color.
  • The ‘Color’ shader handle shapes with per-vertex colors (mostly used by Mesh sprite).
  • The ‘Texture’ shader handle textured shapes (Bitmaps).
  • The ‘TextureColor’ shader handle textured and per-vertex colored shapes.
  • The ‘Particle’ shader deals with Box2D particle systems.

The shader API allows replacing the default shader used by Gideros with a custom one, on a sprite per sprite basis. As with most of Gideros API’s this one is straightforward: create a Shader object and assign it to one or several sprites.

local myShader=Shader.new(shader parameters)
mySprite:setShader(myShader)

That said, since Gideros will use your shader as if it was the standard one, you will have to make sure that your custom shader is compatible with the standard one, which essentially means that it takes the same input parameters.