From 7352ce357d9fed0e5fd2b2e46f9aedcb6d5f5f80 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 27 Jul 2022 11:43:38 +0200 Subject: [PATCH] fixed a bug where the viewport would be cut off by the window if the windows height was smaller than the viewports height --- effects.pde | 2 -- manglr2.pde | 12 ++++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/effects.pde b/effects.pde index f4370bb..babd9bf 100644 --- a/effects.pde +++ b/effects.pde @@ -3934,8 +3934,6 @@ class STREAKER extends Shader { iterations = (int)params.get(8).value; - - println("Running.."); PGraphics temp = createGraphics(img.width, img.height); int off = 0; color c; diff --git a/manglr2.pde b/manglr2.pde index 6ccfca0..b44cde2 100644 --- a/manglr2.pde +++ b/manglr2.pde @@ -82,14 +82,18 @@ void draw() { background(color(0)); viewport = renderer.get(); - + int imgw, imgh; if (renderer.width < renderer.height) { - imgh = (int)height; + imgh = height; imgw = int((float(renderer.width)/float(renderer.height))*height); } else { - imgw = (int)width; - imgh = int((float(renderer.height)/float(renderer.width))*width); + imgw = width; + imgh = int(width/(float(renderer.width)/float(renderer.height))); + if (imgh > height) { + imgh = height; + imgw = int((float(renderer.width)/float(renderer.height))*height); + } } image(viewport, width/2, height/2, imgw, imgh);