You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
759 B
JavaScript
32 lines
759 B
JavaScript
let theShader;
|
|
|
|
function preload(){
|
|
theShader = loadShader('shader.vert', 'shader.frag');
|
|
}
|
|
|
|
function setup() {
|
|
pixelDensity(1);
|
|
createCanvas(windowWidth, windowHeight, WEBGL);
|
|
noStroke();
|
|
}
|
|
|
|
function draw() {
|
|
|
|
theShader.setUniform('u_resolution', [width, height]);
|
|
theShader.setUniform("u_time", millis() / 1000.0); // we divide millis by 1000 to convert it to seconds
|
|
theShader.setUniform("u_mouse", [mouseX, map(mouseY, 0, height, height, 0)]); // we flip Y so it's oriented properly in our shader
|
|
|
|
|
|
// shader() sets the active shader with our shader
|
|
shader(theShader);
|
|
|
|
|
|
// rect gives us some geometry on the screen
|
|
rect(0,0,width, height);
|
|
|
|
}
|
|
|
|
// function windowResized(){
|
|
// resizeCanvas(windowWidth, windowHeight);
|
|
// }
|