audio-vis/shaders/sphere.vert

21 lines
460 B
GLSL

#version 300 es
in vec4 a_position;
uniform mat4 u_world;
uniform mat4 u_matrix;
uniform vec3 u_lightPos;
uniform vec3 u_light;
uniform float u_pointSize;
out vec3 v_surfaceToLight;
void main() {
// convert the position from pixels to 0.0 to 1.0
vec4 pos = a_position * u_matrix;
gl_Position = pos;
gl_PointSize = u_pointSize;
vec3 surfaceWorldPosition = (u_world * pos).xyz;
v_surfaceToLight = u_lightPos - surfaceWorldPosition;
}