aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/je_gl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/Graphics/je_gl.cpp')
-rw-r--r--src/libjin/Graphics/je_gl.cpp116
1 files changed, 0 insertions, 116 deletions
diff --git a/src/libjin/Graphics/je_gl.cpp b/src/libjin/Graphics/je_gl.cpp
deleted file mode 100644
index c58f0ac..0000000
--- a/src/libjin/Graphics/je_gl.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-#define OGL2D_IMPLEMENT
-#include "je_gl.h"
-#include "je_color.h"
-
-using namespace JinEngine::Math;
-
-namespace JinEngine
-{
- namespace Graphics
- {
-
- OpenGL gl;
-
- OpenGL::OpenGL()
- : ogl2d::OpenGL()
- {
- mModelViewMatrices.push_back(Matrix());
- mModelViewMatrix.setIdentity();
- for (Matrix& m : mModelViewMatrices)
- mModelViewMatrix *= m;
- }
-
- void OpenGL::setColor(Channel r, Channel g, Channel b, Channel a)
- {
- setColor(Color(r, g, b, a));
- }
-
- void OpenGL::setColor(Color c)
- {
- mCurrentColor = c;
- glColor4f(c.r / 255.f, c.g / 255.f, c.b / 255.f, c.a / 255.f);
- }
-
- Color OpenGL::getColor()
- {
- return mCurrentColor;
- }
-
- void OpenGL::clearMatrix()
- {
- mModelViewMatrices.clear();
- mModelViewMatrices.push_back(Matrix());
- mModelViewMatrix.setIdentity();
- }
-
- void OpenGL::push()
- {
- mModelViewMatrices.push_back(Matrix());
- }
-
- void OpenGL::pop()
- {
- if (mModelViewMatrices.size() == 1)
- return;
- mModelViewMatrices.pop_back();
- mModelViewMatrix.setIdentity();
- for (Matrix& m : mModelViewMatrices)
- mModelViewMatrix *= m;
- }
-
- void OpenGL::translate(float x, float y)
- {
- if (mModelViewMatrices.size() == 1)
- return;
- Matrix& m = mModelViewMatrices.back();
- m.translate(x, y);
- mModelViewMatrix.translate(x, y);
- }
-
- void OpenGL::scale(float sx, float sy)
- {
- if (mModelViewMatrices.size() == 1)
- return;
- Matrix& m = mModelViewMatrices.back();
- m.scale(sx, sy);
- mModelViewMatrix.scale(sx, sy);
- }
-
- void OpenGL::rotate(float r)
- {
- if (mModelViewMatrices.size() == 1)
- return;
- Matrix& m = mModelViewMatrices.back();
- m.rotate(r);
- mModelViewMatrix.rotate(r);
- }
-
- Matrix OpenGL::getModelViewMatrix(float x, float y, float sx, float sy, float r, float ox, float oy)
- {
- Matrix m;
- m.setTransformation(x, y, r, sx, sy, ox, oy);
- return mModelViewMatrix*m;
- }
-
- Math::Matrix OpenGL::getModelViewMatrix(const Math::Transform& tansform)
- {
- return mModelViewMatrix * tansform.getMatrix();
- }
-
- Matrix OpenGL::getModelViewMatrix()
- {
- return mModelViewMatrix;
- }
-
- const Matrix& OpenGL::getProjectionMatrix()
- {
- return mProjectionMatrix;
- }
-
- void OpenGL::setProjectionMatrix(float l, float r, float b, float t, float n, float f)
- {
- mProjectionMatrix.setOrtho(l, r, b, t, n, f);
- }
-
- } // namespace Graphics
-} // namespace JinEngine \ No newline at end of file