diff options
author | chai <chaifix@163.com> | 2019-04-13 20:15:07 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-04-13 20:15:07 +0800 |
commit | 866e00474be3bfe0e7dac73b720af0b9ebf7109a (patch) | |
tree | 36c44e99352e2d582b4f2f1dbd4e9e672a54f2cf /source/modules/asura-core/graphics/gl.cpp | |
parent | b5b43bac50ad58949e70bcd1a34b1e6c4765fd51 (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, 27 insertions, 3 deletions
diff --git a/source/modules/asura-core/graphics/gl.cpp b/source/modules/asura-core/graphics/gl.cpp index e51e8f0..13c623f 100644 --- a/source/modules/asura-core/graphics/gl.cpp +++ b/source/modules/asura-core/graphics/gl.cpp @@ -68,6 +68,19 @@ namespace AsuraEngine return glGetError(); } + void OpenGL::SetDrawColor(float r, float g, float b, float a) + { + state.drawColor.x = r; + state.drawColor.y = g; + state.drawColor.z = b; + state.drawColor.w = a; + } + + AEMath::Vector4f& OpenGL::GetDrawColor() + { + return state.drawColor; + } + void OpenGL::SetViewport(const Recti v) { state.viewport = v; @@ -81,8 +94,14 @@ namespace AsuraEngine void OpenGL::UseShader(Shader* shader) { - glUseProgram(shader->GetGLProgram()); - state.shader = shader; + if (state.shader != shader) + { + glUseProgram(shader->GetGLProgram()); + state.shader = shader; +#if ASURA_GL_PROFILE + ++stats.shaderSwitch; +#endif + } shader->OnUse(); } @@ -100,7 +119,12 @@ namespace AsuraEngine void OpenGL::DrawArrays(GLenum mode, GLint first, GLsizei count) { glDrawArrays(mode, first, count); - ++state.drawcall; + // shader disableAttributeArray + if (state.shader) + state.shader->DisableAttribArraies(); +#if ASURA_GL_PROFILE + ++stats.drawCall; +#endif } //------------------------------------------------------------------------------// |