redef class App
+ # Graphics program to display static non-moving particles
+ var static_program = new ParticleProgram
+
# Graphics program to display blowing up particles
var explosion_program = new ExplosionProgram
#
# This program should be subclassed to create custom particle effects.
# Either `vertex_shader_source` and `vertex_shader_core` can be refined.
-abstract class ParticleProgram
+class ParticleProgram
super GamnitProgramFromSource
redef var vertex_shader_source = """
uniform bool use_texture;
// Texture to apply on this particle
- uniform sampler2D texture;
+ uniform sampler2D texture0;
void main()
{
if (use_texture) {
- gl_FragColor = texture2D(texture, gl_PointCoord) * v_color;
+ gl_FragColor = texture2D(texture0, gl_PointCoord) * v_color;
if (gl_FragColor.a <= 0.01) discard;
} else {
gl_FragColor = v_color;
var use_texture = uniforms["use_texture"].as(UniformBool) is lazy
# Visible texture unit
- var texture = uniforms["texture"].as(UniformSampler2D) is lazy
+ var texture = uniforms["texture0"].as(UniformSampler2D) is lazy
# Color tint per vertex
var color = attributes["color"].as(AttributeVec4) is lazy