*/
#include <cmath>
-#include "gl.h"
+#include "matrix.h"
#include "projection.h"
namespace Msp {
namespace GL {
+extern MatrixStack *active_stack;
+
void ortho(double left, double right, double bottom, double top, double nearr, double farr)
{
- glOrtho(left, right, bottom, top, nearr, farr);
+ *active_stack *= Matrix::ortho(left, right, bottom, top, nearr, farr);
}
void ortho_centered(double width, double height)
void frustum(double left, double right, double bottom, double top, double nearr, double farr)
{
- glFrustum(left, right, bottom, top, nearr, farr);
+ *active_stack *= Matrix::frustum(left, right, bottom, top, nearr, farr);
}
void frustum_centered(double width, double height, double nearr, double farr)
{
- glFrustum(-width/2, width/2, -height/2, height/2, nearr, farr);
+ frustum(-width/2, width/2, -height/2, height/2, nearr, farr);
}
void perspective(double fov_y, double aspect, double nearr, double farr)
{
- double hh=tan(fov_y*M_PI/360)*nearr;
+ double hh = tan(fov_y*M_PI/360)*nearr;
frustum(-hh*aspect, hh*aspect, -hh, hh, nearr, farr);
}