summaryrefslogtreecommitdiff
path: root/source/modules/asura-core/graphics/gl.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-04-02 21:45:33 +0800
committerchai <chaifix@163.com>2019-04-02 21:45:33 +0800
commitaf7bdaa10ee71a319dc55c3c7556fa43a95c9dc9 (patch)
tree58611985001b78c5a76b78ae146fdb07dde31c1d /source/modules/asura-core/graphics/gl.h
parent250e30d73f09e9da2b5a81d0fbae63744ae12a73 (diff)
*misc
Diffstat (limited to 'source/modules/asura-core/graphics/gl.h')
-rw-r--r--source/modules/asura-core/graphics/gl.h40
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;
+
};
///