X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fprojection.cpp;h=dc690f49f8d65376e7d858f84a0a38488c4b446f;hb=5172d32d67595ea0b70184fadcfcb8e023cccbc8;hp=1b7fa61f11a4389d8799387df6e060fadb3b2188;hpb=bdf2568e247af858c4a1ca8004d97f13fe9b8cb0;p=libs%2Fgl.git diff --git a/source/projection.cpp b/source/projection.cpp index 1b7fa61f..dc690f49 100644 --- a/source/projection.cpp +++ b/source/projection.cpp @@ -6,15 +6,17 @@ Distributed under the LGPL */ #include -#include +#include "matrix.h" #include "projection.h" namespace Msp { namespace GL { -void ortho(double left, double right, double bottom, double top, double near, double far) +extern MatrixStack *active_stack; + +void ortho(double left, double right, double bottom, double top, double nearr, double farr) { - glOrtho(left, right, bottom, top, near, far); + *active_stack *= Matrix::ortho(left, right, bottom, top, nearr, farr); } void ortho_centered(double width, double height) @@ -29,23 +31,23 @@ void ortho_bottomleft(double width, double height) void ortho_topleft(double width, double height) { - ortho(0, width, -height, 0, 0, 1); + ortho(0, width, height, 0, 0, 1); } -void frustum(double left, double right, double bottom, double top, double near, double far) +void frustum(double left, double right, double bottom, double top, double nearr, double farr) { - glFrustum(left, right, bottom, top, near, far); + *active_stack *= Matrix::frustum(left, right, bottom, top, nearr, farr); } -void frustum_centered(double width, double height, double near, double far) +void frustum_centered(double width, double height, double nearr, double farr) { - glFrustum(-width/2, width/2, -height/2, height/2, near, far); + frustum(-width/2, width/2, -height/2, height/2, nearr, farr); } -void perspective(double fov_y, double aspect, double near, double far) +void perspective(double fov_y, double aspect, double nearr, double farr) { - double hh=tan(fov_y*M_PI/360)*near; - frustum(-hh*aspect, hh*aspect, -hh, hh, near, far); + double hh = tan(fov_y*M_PI/360)*nearr; + frustum(-hh*aspect, hh*aspect, -hh, hh, nearr, farr); } } // namespace GL