Class GlslShaderGenerator
java.lang.Object
com.codename1.gpu.GlslShaderGenerator
Generates portable GLSL ES 1.00 vertex and fragment shader source for a given
Material and VertexFormat. This is the "engine-managed shader" code path
shared by every OpenGL ES class backend (Android OpenGL ES and the browser's
WebGL, which share the same shading language). Applications never call this
directly; it exists so the platform backends do not each reimplement shader
emission. The iOS backend has an equivalent Metal generator.
The generated programs use a fixed naming contract that backends rely on when binding attributes and uniforms:
- attributes:
a_position(vec3),a_normal(vec3),a_texcoord(vec2) - uniforms:
u_mvp,u_model,u_normalMatrix(mat4);u_color(vec4);u_texture(sampler2D);u_lightDir,u_lightColor,u_ambient,u_eye(vec3);u_shininess(float)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGlslShaderGenerator(Material material, VertexFormat format) Generates the shader pair for a material and vertex layout. -
Method Summary
Modifier and TypeMethodDescriptionReturns the generated fragment shader source.Returns the generated vertex shader source.
-
Field Details
-
A_POSITION
-
A_NORMAL
-
A_TEXCOORD
The attribute name bound to vertex texture coordinates.- See Also:
-
-
Constructor Details
-
GlslShaderGenerator
Generates the shader pair for a material and vertex layout.
Parameters
-
material: the material describing the lighting model and inputs -
format: the mesh vertex layout
-
-
-
Method Details
-
getVertexSource
Returns the generated vertex shader source. -
getFragmentSource
Returns the generated fragment shader source.
-