webgl-demo fragment shader now has uniform uTime

This commit is contained in:
Emile Clark-Boman 2025-07-28 12:44:46 +10:00
parent d7daf6a391
commit e0bc5aab8b
2 changed files with 45 additions and 3 deletions

View file

@ -1,4 +1,4 @@
function drawScene(gl, programInfo, buffers) {
function drawScene(gl, programInfo, buffers, time) {
gl.clearColor(0.0, 0.0, 0.0, 1.0); // Clear to black, fully opaque
gl.clearDepth(1.0); // Clear everything
gl.enable(gl.DEPTH_TEST); // Enable depth testing
@ -56,6 +56,12 @@ function drawScene(gl, programInfo, buffers) {
modelViewMatrix,
);
// Time since page loaded in seconds
gl.uniform1f(
programInfo.uniformLocations.time,
time,
);
{
const offset = 0;
const vertexCount = 4;