[vert.glsl] #version 130 in vec2 in_position; out vec2 pass_position; void main() { pass_position = in_position; gl_Position = vec4(in_position, 0.0, 1.0); } [frag.glsl] #version 130 #if defined GL_ES precision highp float; #endif in vec2 pass_position; uniform sampler2D u_texture; uniform float u_flag; uniform vec3 u_point; uniform vec3 u_color; void main(void) { if (u_flag == 0.0) { float tc = 0.0, ta = 0.0; { float s = 3.0 + 2.0 * u_point.z; vec2 p = pass_position - u_point.xy * 0.9; float t = clamp(1.2 - dot(s * p, s * p), 0.0, 1.0); float u = t * t * t * t; tc += 3.0 * t * t - 2.0 * t * t * t; ta += 3.0 * u * u - 2.0 * u * u * u; } gl_FragColor = vec4(tc * u_color, ta + 0.1); } else { vec2 texcoords = pass_position * 0.5 + vec2(0.5, 0.5); gl_FragColor = vec4(texture2D(u_texture, texcoords).xyz, 1.0); } }