title: Getting the current projection matrix
body: <p>How do I get and set the current projection matrix in Processing (version 4 beta, P3D renderer) ? Processing provides <code>printProjection()</code>; but doesn't provide a way of getting the data. Current transformation matrix can be saved, get and set using <code>pushMatrix()</code>, <code>getMatrix()</code>, and <code>setMatrix()</code>. Is there and equivalent (or a foolproof work around) for projection matrices ?</p>
  <p>I searched the javadoc version of the documentation and couldn't find anything.</p>
  <p>I attempted to see what <code>printProjection()</code> does in the source code.
  <a href="https://github.com/processing/processing4/blob/master/core/src/processing/core/PApplet.java#L13698" rel="nofollow noreferrer">PApplet.g</a> -&gt;
  <a href="https://github.com/processing/processing4/blob/c9b8a00e7dae72f96688216afe51b0cf755aa639/core/src/processing/opengl/PGraphicsOpenGL.java#L4601" rel="nofollow noreferrer">PGraphicsOpenGL.projection</a> -&gt;
  <a href="https://github.com/processing/processing4/blob/c9b8a00e7dae72f96688216afe51b0cf755aa639/core/src/processing/core/PMatrix3D.java#L96" rel="nofollow noreferrer">PMatrix3D</a> and
  <a href="https://github.com/processing/processing4/blob/c9b8a00e7dae72f96688216afe51b0cf755aa639/core/src/processing/opengl/PGraphicsOpenGL.java#L4098" rel="nofollow noreferrer">PGraphicsOpenGL.pushProjection</a>. Both objects <code>g</code> and <code>projection</code> are public members.</p>
  <p>Origin of this question : I have a class which sets up the camera (It calls <code>camera()</code> and <code>perspective()</code>). I have another class which needs to <em>temporarily</em> reset the transformation and projection matrix so that it can overlay <code>text()</code> on the screen. The transformation matrix can be easily <code>push</code>ed and <code>pop</code>ed. Is there an equivalent for the projection matrix.</p>
  <p>I do not want to manually keep track of the calls to <code>perspective()</code> which sets the projection matrix. One reason is that it will become a burden on the end user and another reason is that I need the original projection matrix set by the <code>size()</code> function to be able to properly place <code>text()</code> on the screen.</p>