X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprojection.cpp;h=dd573da443eb7bcf5a305690cd456a450886eff7;hb=c4fa55619539de9045167250d5b1c13d1827cf7a;hp=2c234525ce63e0240bdc891f6d56c29be0484dcd;hpb=a4ec5410595ddf37bfbc0e85ad87d31a9cbf94f1;p=libs%2Fgl.git diff --git a/source/projection.cpp b/source/projection.cpp index 2c234525..dd573da4 100644 --- a/source/projection.cpp +++ b/source/projection.cpp @@ -1,20 +1,15 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include -#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) @@ -34,17 +29,17 @@ void ortho_topleft(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); }