How to reset the camera?

Hi. I’m using perspective and camera. But how do I reset the view to the default 2d view? I’ve tried resetMatrix, but something else is needed as well?

isn’t it something like, you do pushMatrix() in the beginning, and when you need the original view do popMatrix()

tho idk, never done perspective yet

ortho()
viewMatrix(matrix())

Thanks Ignatz, that’s brilliant!

I can assure you I didn’t think of that

Also good to do resetMatrix() after that.

you probably don’t need viewMatrix if you resetMatrix

I’m a bit confused, but to just call resetMatrix() doesnt do it, it just resets the modelMatrix, am I right?

resetMatrix, popMatrix, and pushMatrix all just affect the model matrix. So if you’ve used camera you need to reset that, using viewMatrix(matrix()) to set it to the identity matrix. If you’ve done a perspective call then you need to reset that, but as it isn’t initially the identity you need ortho to set it back to its original value.