summaryrefslogtreecommitdiff
path: root/source/modules/asura-core/graphics/gl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/modules/asura-core/graphics/gl.cpp')
-rw-r--r--source/modules/asura-core/graphics/gl.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/source/modules/asura-core/graphics/gl.cpp b/source/modules/asura-core/graphics/gl.cpp
index 9ffe010..e199a41 100644
--- a/source/modules/asura-core/graphics/gl.cpp
+++ b/source/modules/asura-core/graphics/gl.cpp
@@ -1,7 +1,9 @@
#include <asura-utils/type.h>
#include "../core_config.h"
+
#include "gl.h"
+#include "shader.h"
using namespace AEMath;
@@ -10,15 +12,16 @@ namespace AsuraEngine
namespace Graphics
{
- bool OpenGL::instantiated = false;
+ static bool _instantiated = false;
//
OpenGL gl;
OpenGL::OpenGL()
{
- ASSERT(!instantiated);
- instantiated = true;
+ // Ҫڶʵ
+ ASSERT(!_instantiated);
+ _instantiated = true;
}
OpenGL::~OpenGL()
@@ -38,7 +41,16 @@ namespace AsuraEngine
return state.viewport;
}
+ void OpenGL::UseShader(Shader* shader)
+ {
+ glUseProgram(shader->GetGLProgramHandle());
+ state.shader = shader;
+ }
+ void OpenGL::UnuseShader()
+ {
+ state.shader = nullptr;
+ }
}
} \ No newline at end of file