xxxxxxxxxx
60
//basically, pixel perfect display at 125% ui scale sucks ass. i tweaked scale and translate until every horizontal line with y=2+5n was exactly one px wide. but every other height doesnt work. i cant explain this. just deal with it for now and use 100% scale
const topbar=1;
let margin;
let halfw,halfh;
let shift=0;
let secs;
//3d shader stuff
let theShader;
let shaderBG;
function preload(){
theShader = loadShader('shader.vert','shader.frag');
}
function setup() {
// pixelDensity(1);
createCanvas(1920, 1080-42*topbar);
halfw=width/2;
halfh=height/2;
margin = round(0.05*height);
shaderBG = createGraphics(width,height,WEBGL);
shaderBG.noStroke();
strokeWeight(1);
}
function draw() {
background(255);
//do shader bg
secs = millis()*0.001;
shaderBG.shader(theShader);
theShader.setUniform('time', secs);
shaderBG.push();
shaderBG.background(255);
shaderBG.rotateY(secs);
shaderBG.rotateX(secs*0.5);
shaderBG.sphere(100);
image(shaderBG,0,0,width,height)
shaderBG.pop();
translate(0.5,0.5); //needed to sync pixels fsr
line(margin,3*margin,width-margin,3*margin);
line(margin,height-margin,width-margin,height-margin);
// rect(mouseX-12.5*cos(secs), mouseY-12.5*sin(secs*1.2), 25*cos(secs), 25*sin(secs*1.2))
}
function mouseClicked(){
shift++;
print(mouseY);
}