Skip to content

Instantly share code, notes, and snippets.

@Razzlegames
Created May 5, 2015 19:30
Show Gist options
  • Save Razzlegames/66f5ce07b66492a18d22 to your computer and use it in GitHub Desktop.
Save Razzlegames/66f5ce07b66492a18d22 to your computer and use it in GitHub Desktop.
// Vertex shader
/**
* This is for rendering colored liquid/particles using LiquidFun etc
*/
uniform mat4 u_view_projection_matrix;
uniform float u_depth;
attribute vec4 a_Position;
attribute vec4 a_color;
attribute float a_size;
varying vec4 v_color;
void main()
{
v_color = a_color + vec4(0.0, 0.0, 0.4, 1.0);
//v_color = vec4(0.0, 0.0, 1.0, 1.0);
gl_PointSize = a_size;
//vec4 pos = vec4(a_Position.xy, u_depth, a_Position.w);
vec4 pos = a_Position;
pos.z = u_depth;
gl_Position = u_view_projection_matrix * pos;
}
// Fragment shader
/**
* This is for rendering colored liquid/particles using LiquidFun etc
*/
#ifdef GL_ES
precision lowp float;
#endif
uniform sampler2D u_texture;
varying vec4 v_color;
void main()
{
// Get frag from texture
//gl_FragColor = v_color;
gl_FragColor = texture2D(u_texture, gl_PointCoord);
// vec4 color = texture2D(u_texture, gl_PointCoord) * v_color;
// gl_FragColor = color;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment