I’m trying to get a better grip in the gl commands to send to jit.gl.sketch. So: In the Jitter tutorials, we’re told how to rotate an sketched shape, and to do so we need to use ‘glmatrixmode modelview, glpushmatrix, …, gl popmatrix’. However, the glrotate command seems to work without these. Why do we need the push and popmatrix commands? Like I said, just trying to understand! I can’t quite get the explanation the tutorials give. Thanks for your help.
opengl operates as a state machine, so any command you send changes the state for all subsequent commands.
additionally transform commands (rotate, translate, scale) concatenate together to get the final transform.
pushmatrix and popmatrix allow you to modify the transform, without affecting subsequent transform states.
if you transform messages are intended to affect all subsequent draw calls, you won’t need push and pop.
yes it’s confusing, this is why we’ve abstracted a lot of this with the jit.gl and jit.anim objects,
as of max 6, there should be very little need to delve into low-level opengl calls.
unless you enjoy the pain!