Implement PGraphicsOpenGL.getMatrix(PMatrix2D) (Issue #5063) by Romejanic · Pull Request #5826 · processing/processing
I implemented a currently unimplemented feature which is to store the current modelview matrix of a P2D sketch into a PMatrix2D object, so that it could be used elsewhere or applied later through applyMatrix().
size(200,200,P2D); translate(50,75); rotate(0.2); scale(random(0.5f,2f)); printMatrix(); PMatrix2D matrix = new PMatrix2D(); getMatrix(matrix); matrix.print(); resetMatrix(); fill(255,0,0); rect(50,50,50,50); applyMatrix(matrix); rect(50,50,50,50);