Platform based Shaders
The API allows the creation of Shader objects from within Lua. The ‘Shader.new()’ constructor takes five arguments:
- The vertex shader - filename (no extension) or code within a string.
- The fragment shader - filename (no extension) or code within a string.
- A set of numerical flags or 0 if none.
- An array of uniforms/constants descriptors.
- An array of attributes descriptors.
Gideros will search the assets for a file with the supplied name, automatically adding the extension relevant for the target platform: .glsl for OpenGL, .cso or .hlsl for DirectX. The Flag 'Shader.FLAG_FROM_CODE' can be used to let Gideros know that the string is actually Shader code, not contained within a file.