diff options
Diffstat (limited to 'src/libjin/graphics/je_gl.h')
-rw-r--r-- | src/libjin/graphics/je_gl.h | 99 |
1 files changed, 30 insertions, 69 deletions
diff --git a/src/libjin/graphics/je_gl.h b/src/libjin/graphics/je_gl.h index 60b2396..4f53152 100644 --- a/src/libjin/graphics/je_gl.h +++ b/src/libjin/graphics/je_gl.h @@ -14,13 +14,11 @@ namespace JinEngine { namespace Graphics { - // Wrap OpenGL API. -/* + + namespace Shaders { class Shader; }; + namespace Fonts { class Font; }; class Canvas; - class Shader; - class Font; -*/ class OpenGL { @@ -40,87 +38,51 @@ namespace JinEngine OpenGL(); ~OpenGL(); - inline void enable(GLenum cap) - { - glEnable(cap); - } + void enable(GLenum cap); - inline void disable(GLenum cap) - { - glDisable(cap); - } -/* - inline void setBlendFunc(GLenum sfactor, GLenum dfactor) - { - glBlendFunc(sfactor, dfactor); - } -*/ - inline void setClearColor(GLubyte r, GLubyte g, GLubyte b, GLubyte a) - { - glClearColor(r / 255.f, g / 255.f, b / 255.f, a / 255.f); - } + 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 bindTexture(GLuint texture = 0); - inline GLuint curTexture() - { - return mTexture; - } + + GLuint curTexture(); + 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 activeTexUnit(unsigned int unit = 0); - inline void drawArrays(GLenum mode, GLint first, GLsizei count) - { - glDrawArrays(mode, first, count); - } + void drawArrays(GLenum mode, GLint first, GLsizei count); - inline void drawBuffer(GLenum mode) - { + void drawBuffer(GLenum mode); - } + void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); - inline void drawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) - { - - } + void enableClientState(GLenum arr); - inline void enableClientState(GLenum arr) - { - glEnableClientState(arr); - } - - inline void disableClientState(GLenum arr) - { - glDisableClientState(arr); - } + void disableClientState(GLenum arr); - inline GLuint genFrameBuffer() - { - GLuint fbo; - glGenFramebuffers(1, &fbo); - return fbo; - } + GLuint genFrameBuffer(); - inline void bindFrameBuffer(GLuint fbo) - { - glBindFramebuffer(GL_FRAMEBUFFER, fbo); - } + void bindFrameBuffer(GLuint fbo); - inline void ortho(int w, float radio) - { - glOrtho(0, w, w*radio, 0, -1, 1); - } + void ortho(int w, float radio); - inline void orthox(int w, int h) - { - glOrtho(0, w, h, 0, -1, 1); - } + void orthox(int w, int h); void setColor(Channel r, Channel g, Channel b, Channel a); @@ -226,7 +188,6 @@ namespace JinEngine struct { GLubyte r, g, b, a; } mPrecolor; // previous draw color GLuint mTexture; // current binded texture -/* /// /// /// @@ -235,13 +196,13 @@ namespace JinEngine /// /// /// - Shader* mCurrentShader; + Shaders::Shader* mCurrentShader; /// /// /// - Font* mCurrentFont; -*/ + Fonts::Font* mCurrentFont; + }; // Singleton. |