3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
10 #include "projection.h"
15 void ortho(double left, double right, double bottom, double top, double near, double far)
17 glOrtho(left, right, bottom, top, near, far);
20 void ortho_centered(double width, double height)
22 ortho(-width/2, width/2, -height/2, height/2, 0, 1);
25 void ortho_bottomleft(double width, double height)
27 ortho(0, width, 0, height, 0, 1);
30 void ortho_topleft(double width, double height)
32 ortho(0, width, height, 0, 0, 1);
35 void frustum(double left, double right, double bottom, double top, double near, double far)
37 glFrustum(left, right, bottom, top, near, far);
40 void frustum_centered(double width, double height, double near, double far)
42 glFrustum(-width/2, width/2, -height/2, height/2, near, far);
45 void perspective(double fov_y, double aspect, double near, double far)
47 double hh=tan(fov_y*M_PI/360)*near;
48 frustum(-hh*aspect, hh*aspect, -hh, hh, near, far);