diff options
Diffstat (limited to 'source/modules/asura-core/graphics/gl.h')
-rw-r--r-- | source/modules/asura-core/graphics/gl.h | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/source/modules/asura-core/graphics/gl.h b/source/modules/asura-core/graphics/gl.h index 4d21a5a..9ca1f44 100644 --- a/source/modules/asura-core/graphics/gl.h +++ b/source/modules/asura-core/graphics/gl.h @@ -1,21 +1,28 @@ #ifndef __ASURA_ENGINE_OPENGL_H__ #define __ASURA_ENGINE_OPENGL_H__ -#include <asura-utils/math/rect.hpp> +#include <stack> #include <glad/glad.h> +#include <asura-utils/math/rect.hpp> +#include <asura-utils/math/matrix44.h> + +#include "matrix_stack.h" + namespace AsuraEngine { namespace Graphics { class Profiler; + class Shader; /// - /// һЩopengl״̬١ڱ༭രڻ£һڶӦһhwndһhdcԼ - /// opengl contextʹwglMakeCurrent(hdc, glc)ָǰ̶߳Ⱦhdc - /// openglglcglм¼ľһ̵߳һڵһopenglĵ״̬ + /// OpenGLģһЩopengl״̬١ڱ༭രڻ£һڶӦһhwnd + /// һhdcԼopengl contextʹwglMakeCurrent(hdc, glc)ָǰ̶߳ + /// Ⱦhdcopenglglcglм¼ľһ̵߳һڵһOpenGL + /// ĵ״̬ /// class OpenGL { @@ -26,23 +33,28 @@ namespace AsuraEngine void SetViewport(const AEMath::Recti viewport); AEMath::Recti GetViewport(); - private: - - friend class Profiler; + void UseShader(Shader* shader); + void UnuseShader(); - /// - /// opengl /// - static bool instantiated; - - /// - /// ¼opengl״̬ + /// OpenGL3.0Ժû任ӿڡshaderȲﱣһЩOpenGL״̬ע + /// ƺȫ̵ģҲ˵Asuraֶ֧߳ȾOpenGLĵĴʹһ + /// İһHDC\ϣڴض̴߳ģOpenGLҲһ + /// ض̡߳ͬһ̵߳IJͬHDC\ڿԹͬһOpenGLġΪ + /// дtextuer\shaderhandle /// struct { - AEMath::Recti viewport; + Shader* shader; ///< ǰʹõshader + AEMath::Recti viewport; ///< ǰлHDC߱ڴСı߲ˢʱ䶯 + MatrixStack projectionMatrix; ///< ͶӰ + MatrixStack modelViewMatrix; ///< 任 } state; + private: + + friend class Profiler; + }; /// |