How do I draw ie a GUI/Texture in ortho (screen) mode
I must say the documentation on this subject/object is very poor/none.
Matrix4x4.Ortho
static function Ortho (left : float, right : float, bottom : float, top : float, zNear : float, zFar : float) : Matrix4x4
Description
Creates an orthogonal projection matrix.
The returned matrix is such that views left to right, bottom to top area, with zNear and zFar depth clipping planes.
- What values do I use for left, right, top, bottom?
- In what event/method do I actual call drawmeshnow?
In all my attempts I got either nothing or the object drawn in 3d
I tried
float left = 0f;
float right = Screen.width;
float bottom = 0f;
float top = Screen.height;
Matrix4x4 matrix = Matrix4x4.Ortho(left, right, bottom, top, Camera.current.near, Camera.current.far);
Graphics.DrawMeshNow(mesh, matrix);
GL.PushMatrix();
GL.LoadIdentity(); // With and without LoadIdentity
GL.LoadPixelMatrix();
// I tried using gui matrix
Graphics.DrawMeshNow(mesh, GUI.matrix);
// I tried using identity matrix
Graphics.DrawMeshNow(mesh, Matrix4x4.identity);
GL.PopMatrix();
GL.PushMatrix();
GL.LoadIdentity(); // With and without LoadIdentity
GL.LoadPixelMatrix(0, Screen.width, 0, Screen.height);
// I tried using gui matrix
Graphics.DrawMeshNow(mesh, GUI.matrix);
// I tried using identity matrix
Graphics.DrawMeshNow(mesh, Matrix4x4.identity);
GL.PopMatrix();
Camera.main.orthographic = true;
// I tried using gui matrix
Graphics.DrawMeshNow(mesh, GUI.matrix);
// I tried using identity matrix
Graphics.DrawMeshNow(mesh, Matrix4x4.identity);
Camera.main.orthographic = false;
Camera.current.orthographic = true;
// I tried using gui matrix
Graphics.DrawMeshNow(mesh, GUI.matrix);
// I tried using identity matrix
Graphics.DrawMeshNow(mesh, Matrix4x4.identity);
Camera.current.orthographic = false;