I'm trying to create the correct projection and model view matrix for rendering without a camera.
_orthoCamera
is a camera I set up in the scene view. Using the _orthoCamera
projection matrix and modelView
matrix works but I don't know exactly how to recreate these. My attempt is the commented code.
//not correct
//var projection = Matrix4x4.Ortho(-512, 512, -512, 512, 0.3f, 1000);
//var modelView = Matrix4x4.LookAt(new Vector3(512, 512, -5), new Vector3(512, 512, 0), Vector3.up); //inverse?
//correct result
var projection = _orthoCamera.projectionMatrix;
var modelView = _orthoCamera.worldToCameraMatrix;
GL.LoadProjectionMatrix(projection);
GL.modelview = (modelView);