aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/graphics/je_gl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/graphics/je_gl.h')
-rw-r--r--src/libjin/graphics/je_gl.h270
1 files changed, 0 insertions, 270 deletions
diff --git a/src/libjin/graphics/je_gl.h b/src/libjin/graphics/je_gl.h
deleted file mode 100644
index 6f88ba1..0000000
--- a/src/libjin/graphics/je_gl.h
+++ /dev/null
@@ -1,270 +0,0 @@
-#ifndef __JE_OPENGL_H__
-#define __JE_OPENGL_H__
-
-#include <vector>
-
-#include "../math/je_matrix.h"
-#include "../math/je_transform.h"
-
-//#include "GLee/GLee.h"
-#include "glad/glad.h"
-
-#include "je_color.h"
-
-namespace JinEngine
-{
- namespace Graphics
- {
- // Wrap OpenGL API.
-
- namespace Shaders { class Shader; };
- namespace Fonts { class Font; };
-
- class Texture;
-
- class Canvas;
-
- class OpenGL
- {
- public:
- ///
- /// Blend mode.
- /// https://www.andersriggelsen.dk/glblendfunc.php
- ///
- enum class BlendMode
- {
- ALPHA = 1,
- ADDITIVE = 2,
- PREMULTIPLIEDALPHA = 3,
- };
-
- struct Stats
- {
- int drawCalls;
- //int drawCallsBatched;
- int canvasSwitches;
- int shaderSwitches;
- int fontSwitches;
- int textures;
- int canvases;
- int fonts;
- //int64 textureMemory;
- };
-
- static Canvas* const SCREEN;
-
- OpenGL();
- ~OpenGL();
-
- bool initContext();
-
- void init();
-
- void enable(GLenum cap);
-
- void disable(GLenum cap);
-
- void setClearColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a);
-
- void pushColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a = 255);
-
- void popColor();
-
- void flushError();
-
- GLuint genTexture();
-
- void deleteTexture(GLuint texture);
-
- void bindTexture2D(GLuint texture = 0);
-
- void setTexParameter(GLenum pname, GLint param);
-
- void texImage(GLint internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels = NULL);
-
- void texSubImage(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
-
- void activeTextureUnit(unsigned int unit = 0);
-
- void drawArrays(GLenum mode, GLint first, GLsizei count);
-
- void drawBuffer(GLenum mode);
-
- void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
-
- void enableClientState(GLenum arr);
-
- void disableClientState(GLenum arr);
-
- GLuint genFrameBuffer();
-
- void bindFrameBuffer(GLuint fbo);
-
- void ortho(int w, float radio);
-
- void orthox(int w, int h);
-
- void setColor(Channel r, Channel g, Channel b, Channel a);
-
- void setColor(Color c);
-
- Color getColor();
-
- void clearMatrix();
-
- void pushMatrix();
-
- void translate(float x, float y);
-
- void scale(float sx, float sy);
-
- void rotate(float r);
-
- void popMatrix();
-
- ///
- ///
- ///
- Math::Matrix getModelViewMatrix(const Math::Transform& tansform);
-
- ///
- /// Get model view matrix.
- ///
- Math::Matrix getModelViewMatrix(float x, float y, float sx, float sy, float r, float ox, float oy);
-
- ///
- /// Get model view matrix.
- ///
- Math::Matrix getModelViewMatrix();
-
- ///
- /// Set orthogonal matrix.
- ///
- void setProjectionMatrix(float l, float r, float b, float t, float n, float f);
-
- ///
- /// Get orthogonal matrix.
- ///
- const Math::Matrix& getProjectionMatrix();
-
- ///
- ///
- ///
- void useShader(Shaders::Shader* shader);
-
- ///
- ///
- ///
- void unuseShader();
-
- ///
- ///
- ///
- Shaders::Shader* getShader();
-
- ///
- ///
- ///
- void setFont(Fonts::Font* font);
-
- ///
- ///
- ///
- void unsetFont();
-
- ///
- ///
- ///
- Fonts::Font* getFont();
-
- ///
- ///
- ///
- void bindCanvas(Canvas* canvas);
-
- ///
- ///
- ///
- void unbindCanvas();
-
- ///
- ///
- ///
- Canvas* getCanvas();
-
- ///
- ///
- ///
- void setBlendMode(BlendMode mode);
-
- ///
- ///
- ///
- BlendMode getBlendMode();
-
- ///
- ///
- ///
- void resetStats();
-
- ///
- ///
- ///
- Stats& getStats();
-
- private:
-
- ///
- ///
- ///
- std::vector<Math::Matrix> mModelViewMatrices;
-
- ///
- ///
- ///
- Math::Matrix mModelViewMatrix;
-
- ///
- ///
- ///
- Math::Matrix mProjectionMatrix;
-
- ///
- ///
- ///
- BlendMode mBlendMode;
-
- ///
- ///
- ///
- Color mColor;
-
- ///
- ///
- ///
- Canvas* mCanvas;
-
- ///
- ///
- ///
- Shaders::Shader* mShader;
-
- ///
- ///
- ///
- Fonts::Font* mFont;
-
- ///
- ///
- ///
- Stats mStats;
-
- };
-
- // Singleton.
- extern OpenGL gl;
-
- } // namespace Graphics
-} // namespace JinEngine
-
-#endif // __JE_OPENGL_H__ \ No newline at end of file