00001 #include <gl/glut.h>
00002 #include <windows.h>
00003 #include <gl/glu.h>
00004
00005 #include "LifeVariables.h"
00006 #include "OrthographicSpace.h"
00007
00008 using namespace std;
00009
00010 OrthographicSpace::OrthographicSpace() {
00011 this->setBorders(DEFAULT_ORTHO_LEFT_PLANE,
00012 DEFAULT_ORTHO_RIGHT_PLANE,
00013 DEFAULT_ORTHO_BOTTOM_PLANE,
00014 DEFAULT_ORTHO_TOP_PLANE);
00015 }
00016
00017
00018 OrthographicSpace::OrthographicSpace(int left, int right, int bottom, int top) {
00019 this->setBorders(left,right,bottom,top);
00020 }
00021
00022
00023 void OrthographicSpace::setBorders(int left, int right, int bottom, int top) {
00024 this->left = left;
00025 this->right = right;
00026 this->bottom = bottom;
00027 this->top = top;
00028 }
00029
00030
00031 void OrthographicSpace::setOrthographicProjection() {
00032 glMatrixMode(GL_PROJECTION);
00033 glPushMatrix();
00034 glLoadIdentity();
00035 gluOrtho2D(left, right, bottom, top);
00036 glMatrixMode(GL_MODELVIEW);
00037 glPushMatrix();
00038 glLoadIdentity();
00039 }
00040
00041
00042 void OrthographicSpace::resetProjection() {
00043 glMatrixMode(GL_PROJECTION);
00044 glPopMatrix();
00045 glMatrixMode(GL_MODELVIEW);
00046 glPopMatrix();
00047 }