Fixes #18. Updated wavy fragment shader

- Used vTexCoords instead of gl_FragCoord
This commit is contained in:
Bryan Dela Cruz 2019-12-21 17:05:18 +08:00
parent 0d1d22b509
commit 6be8878d2a
1 changed files with 2 additions and 1 deletions

View File

@ -67,6 +67,7 @@ func main() {
var fragmentShader = ` var fragmentShader = `
#version 330 core #version 330 core
in vec2 vTexCoords;
out vec4 fragColor; out vec4 fragColor;
uniform sampler2D uTexture; uniform sampler2D uTexture;
@ -77,7 +78,7 @@ uniform float uSpeed;
uniform float uTime; uniform float uTime;
void main() { void main() {
vec2 t = gl_FragCoord.xy / uTexBounds.zw; vec2 t = vTexCoords / uTexBounds.zw;
vec3 influence = texture(uTexture, t).rgb; vec3 influence = texture(uTexture, t).rgb;
if (influence.r + influence.g + influence.b > 0.3) { if (influence.r + influence.g + influence.b > 0.3) {