Table of Contents


Inherits: Object

Supported platforms:

Available since version: Gideros 2015.06.30


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
- and the ‘Particle’ shader deals with Box2D particle systems
The new shader API allows to replace 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 straight-forward: create a Shader object and assign it to one or several sprites.
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.

Common uses and examples:

Shader example

--Shaders are in vShader.glsl and fShader.glsl files

local"vShader","fShader",0, {
{name="fRad",type=Shader.CINT,vertex=false}, }, 
{ {name="vVertex",type=Shader.DFLOAT,mult=3,slot=0,offset=0}, 
{name="vTexCoord",type=Shader.DFLOAT,mult=2,slot=2,offset=0}, });

shader:setConstant("fRad",Shader.CINT,1,0) --Initial blur level 
shader:setConstant("fTexelSize",Shader.CFLOAT4,1,{1/texw,1/texh,0,0}) --Initial texel size


Methods, events and properties: