diff options
author | chai <chaifix@163.com> | 2019-04-06 07:39:49 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-04-06 07:39:49 +0800 |
commit | e47baca4f23db43ec91fbf64d5d06d7c0dbee495 (patch) | |
tree | 9e909413bbf61834570e7dbdbe37fc8705f12730 /source/modules/asura-core/graphics/gl.cpp | |
parent | e13616b5c40f912853be99f0603f0e4c97b22062 (diff) |
*misc
Diffstat (limited to 'source/modules/asura-core/graphics/gl.cpp')
-rw-r--r-- | source/modules/asura-core/graphics/gl.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/source/modules/asura-core/graphics/gl.cpp b/source/modules/asura-core/graphics/gl.cpp index 47476a7..54fadb7 100644 --- a/source/modules/asura-core/graphics/gl.cpp +++ b/source/modules/asura-core/graphics/gl.cpp @@ -30,13 +30,41 @@ namespace AsuraEngine { } + bool OpenGL::Init(const AEMath::Recti& view) + { + bool loaded = false; +#if ASURA_OPENGL_LOADER & ASURA_OPENGL_GLAD + if (!loaded) + loaded = gladLoadGL(); +#endif + if (!loaded) + return false; + state.viewport = view; + return true; + } + + void OpenGL::WipeError() + { + while (glGetError() != GL_NO_ERROR); + } + + bool OpenGL::HasError() + { + return glGetError() != GL_NO_ERROR; + } + + GLenum OpenGL::GetError() + { + return glGetError(); + } + void OpenGL::SetViewport(const Recti v) { glViewport(v.x, v.y, v.w, v.h); state.viewport = v; } - Recti OpenGL::GetViewport() + const Recti& OpenGL::GetViewport() { return state.viewport; } |