Difference between revisions of "Shader"

From GiderosMobile
(Created page with "__NOTOC__ '''Supported platforms:''' <br/> '''Available since:''' Gideros 2015.06.30<br/> === Description === Gideros internally uses five distinct shaders: - the ‘Basic’...")
 
Line 12: Line 12:
 
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.
 
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.{|-
+
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.
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
{|-
 
| style="width: 50%;"|
 
| style="width: 50%;"|
 
=== Methods ===
 
=== Methods ===
 +
[[Shader.new]] - create new shader<br/>
 +
[[Shader:getEngineVersion]] - get shader version<br/>
 +
[[Shader:getProperties]] - get graphics engine properties<br/>
 +
[[Shader:getShaderLanguage]] - Get shader language<br/>
 +
[[Shader:setConstant]] - change the value of a uniform<br/>
 
| style="width: 50%;"|
 
| style="width: 50%;"|
 
=== Events ===
 
=== Events ===
 
=== Constants ===
 
=== Constants ===
 +
[[Shader.CFLOAT]]
 +
[[Shader.CFLOAT4]]
 +
[[Shader.CINT]]
 +
[[Shader.CMATRIX]]
 +
[[Shader.CTEXTURE]]
 +
[[Shader.DBYTE]]
 +
[[Shader.DFLOAT]]
 +
[[Shader.DINT]]
 +
[[Shader.DSHORT]]
 +
[[Shader.DUBYTE]]
 +
[[Shader.DUSHORT]]
 +
[[Shader.FLAG_FROM_CODE]]
 +
[[Shader.FLAG_NONE]]
 +
[[Shader.FLAG_NO_DEFAULT_HEADER]]
 +
[[Shader.SYS_COLOR]]
 +
[[Shader.SYS_NONE]]
 +
[[Shader.SYS_PARTICLESIZE]]
 +
[[Shader.SYS_TEXTUREINFO]]
 +
[[Shader.SYS_WIT]]
 +
[[Shader.SYS_WORLD]]
 +
[[Shader.SYS_WVP]]
 
|}
 
|}

Revision as of 08:57, 23 August 2018

Supported platforms:
Available since: Gideros 2015.06.30

Description

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.














Methods

Shader.new - create new shader
Shader:getEngineVersion - get shader version
Shader:getProperties - get graphics engine properties
Shader:getShaderLanguage - Get shader language
Shader:setConstant - change the value of a uniform

Events

Constants

Shader.CFLOAT Shader.CFLOAT4 Shader.CINT Shader.CMATRIX Shader.CTEXTURE Shader.DBYTE Shader.DFLOAT Shader.DINT Shader.DSHORT Shader.DUBYTE Shader.DUSHORT Shader.FLAG_FROM_CODE Shader.FLAG_NONE Shader.FLAG_NO_DEFAULT_HEADER Shader.SYS_COLOR Shader.SYS_NONE Shader.SYS_PARTICLESIZE Shader.SYS_TEXTUREINFO Shader.SYS_WIT Shader.SYS_WORLD Shader.SYS_WVP