Is there a clever way to ignore/reset any changes to the matrix that happen outside of a push/popMatrix
? Say I draw some objects normally using push/popMatrix()
, then I’m calculating various things and have some debug views that are loaded as PGraphic layers… now I want to rotate the entire canvas 90° to match a 90° rotated screen. BTW, this would be executed by a library, so I’m trying to have a function simply add the following code to the top of the draw:
translate(width/2, height/2);
rotate(radians(90));
translate(-width/2, -height/2);
However that then throws off the position of the debug views later in the code. Of course I could wrap big push/popMatrix()
around everything prior to the debug views, but there must be a better way. I was trying to find something that could tell the images to ignore any previous changes to the matrix… i tried resetMatrix()
– but that didn’t do what I expected… I also tried storing the current matrix using getMatrix()
within a variable and reloading it with applyMatrix()
– but that too showed everything far smaller than expected. Looking to place one line of code before those debug images that undoes any translate/rotate/scale changes. Anyone know the proper way to do this?