Difference between revisions of "Shader"
m (Text replacement - "</source>" to "</syntaxhighlight>") |
|||
Line 13: | Line 13: | ||
*and the ‘'''Particle'''’ shader deals with Box2D particle systems | *and 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. | + | The shader API allows replacing the default shader used by Gideros with a custom one, on a sprite per sprite basis. You create a Shader object and assign it to one or several sprites. '''[[Writing Shaders]]''' |
− | 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 | + | 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 Gideros standard Shader, which essentially means that it takes the same input parameters. |
− | + | '''The recommended way is to write your shader code in Lua, it will then be automatically translated to the relevant shader language for the platform you are using, eg GLSL, HLSL or MTL''': '''[[Lua Shaders]]''' | |
− | |||
− | |||
− | ''' | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
{|- | {|- |
Revision as of 23:12, 3 October 2023
Supported platforms:
Available since: Gideros 2015.06.30
Inherits from: Object
Description
Gideros internally uses five distinct shaders:
- the ‘Basic’ shader handles shapes with a constant color
- the ‘Color’ shader handles shapes with per-vertex colors (mostly used by Mesh sprite)
- the ‘Texture’ shader handles textured shapes (Bitmaps)
- the ‘TextureColor’ shader handles textured and per-vertex colored shapes
- and 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. You create a Shader object and assign it to one or several sprites. Writing Shaders
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 Gideros standard Shader, which essentially means that it takes the same input parameters.
The recommended way is to write your shader code in Lua, it will then be automatically translated to the relevant shader language for the platform you are using, eg GLSL, HLSL or MTL: Lua Shaders
MethodsShader.new creates a new shader |
EventsConstantsShader.CFLOAT a float value |