From 0a357f01091a54d94084e2bbfb3a53d10216864b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Fri, 12 Aug 2022 23:24:15 +0100 Subject: [PATCH] Change background color --- src/music/features/visualizer/Renderer.ts | 8 +++++++- src/music/features/visualizer/shaders/vertices.glsl | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/music/features/visualizer/Renderer.ts b/src/music/features/visualizer/Renderer.ts index dca49fb..bbd705b 100644 --- a/src/music/features/visualizer/Renderer.ts +++ b/src/music/features/visualizer/Renderer.ts @@ -6,6 +6,7 @@ import vertexSource from "./shaders/vertices.glsl"; import fragmentSource from "./shaders/fragments.glsl"; const ROTATION_SPEED = 0.0005; +const BACKGROUND_COLOR = [0.0588235294118, 0.0588235294118, 0.0588235294118]; class RendererError extends Error {} @@ -148,7 +149,12 @@ class Renderer { initGL(gl: WebGLRenderingContext, shader: Shader) { gl.useProgram(shader.program); - gl.clearColor(0.0, 0.0, 0.0, 1.0); + gl.clearColor( + BACKGROUND_COLOR[0], + BACKGROUND_COLOR[1], + BACKGROUND_COLOR[2], + 1.0 + ); gl.clearDepth(1.0); gl.enable(gl.DEPTH_TEST); gl.depthFunc(gl.LESS); diff --git a/src/music/features/visualizer/shaders/vertices.glsl b/src/music/features/visualizer/shaders/vertices.glsl index 20948b1..93f65e1 100644 --- a/src/music/features/visualizer/shaders/vertices.glsl +++ b/src/music/features/visualizer/shaders/vertices.glsl @@ -4,7 +4,7 @@ // Takes vertices of a unit cube, scales them up along Y according to // aHeight, and colors them with basic diffuse shading. -#define CLEAR_COLOR vec4(0.0, 0.0, 0.0, 1.0) +#define CLEAR_COLOR vec4(0.0588235294118, 0.0588235294118, 0.0588235294118, 1.0) #define BASE_COLOR vec3(0.6, 0.819607843137, 0.807843137255) #define AMBIENT_LIGHT vec3(0.3, 0.3, 0.3) #define LIGHT_DIRECTION normalize(vec3(0.85, 0.8, 0.75))