aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/opengl/pipelines
diff options
context:
space:
mode:
authorJohannes Schickel2016-03-02 15:16:05 +0100
committerJohannes Schickel2016-03-16 20:29:31 +0100
commitbaca885cfce10acaa7a9892133aaa5b82c7183f7 (patch)
tree8f1c0d94fac540185c385dac292615f7d82cfe51 /backends/graphics/opengl/pipelines
parent6dacc96d1f6ed804197382c59765c8cec5146c62 (diff)
downloadscummvm-rg350-baca885cfce10acaa7a9892133aaa5b82c7183f7.tar.gz
scummvm-rg350-baca885cfce10acaa7a9892133aaa5b82c7183f7.tar.bz2
scummvm-rg350-baca885cfce10acaa7a9892133aaa5b82c7183f7.zip
OPENGL: Let Shader store the uniform state.
Diffstat (limited to 'backends/graphics/opengl/pipelines')
-rw-r--r--backends/graphics/opengl/pipelines/clut8.cpp2
-rw-r--r--backends/graphics/opengl/pipelines/shader.cpp10
-rw-r--r--backends/graphics/opengl/pipelines/shader.h1
3 files changed, 8 insertions, 5 deletions
diff --git a/backends/graphics/opengl/pipelines/clut8.cpp b/backends/graphics/opengl/pipelines/clut8.cpp
index 9f2aa94b90..fca40074f0 100644
--- a/backends/graphics/opengl/pipelines/clut8.cpp
+++ b/backends/graphics/opengl/pipelines/clut8.cpp
@@ -32,8 +32,6 @@ CLUT8LookUpPipeline::CLUT8LookUpPipeline()
}
void CLUT8LookUpPipeline::drawTexture(const GLTexture &texture, const GLfloat *coordinates) {
- _activeShader->setUniformI(_activeShader->getUniformLocation("palette"), 1);
-
// Set the palette texture.
GL_CALL(glActiveTexture(GL_TEXTURE1));
if (_paletteTexture) {
diff --git a/backends/graphics/opengl/pipelines/shader.cpp b/backends/graphics/opengl/pipelines/shader.cpp
index 69af911fc6..46e81423c5 100644
--- a/backends/graphics/opengl/pipelines/shader.cpp
+++ b/backends/graphics/opengl/pipelines/shader.cpp
@@ -38,6 +38,12 @@ void ShaderPipeline::activateInternal() {
if (g_context.multitextureSupported) {
GL_CALL(glActiveTexture(GL_TEXTURE0));
}
+
+ _activeShader->activate();
+}
+
+void ShaderPipeline::deactivateInternal() {
+ _activeShader->deactivate();
}
void ShaderPipeline::setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
@@ -53,9 +59,7 @@ void ShaderPipeline::drawTexture(const GLTexture &texture, const GLfloat *coordi
}
void ShaderPipeline::setProjectionMatrix(const GLfloat *projectionMatrix) {
- if (isActive() && _activeShader) {
- _activeShader->activate(projectionMatrix);
- }
+ _activeShader->setUniform("projection", new ShaderUniformMatrix44(projectionMatrix));
}
#endif // !USE_FORCED_GLES
diff --git a/backends/graphics/opengl/pipelines/shader.h b/backends/graphics/opengl/pipelines/shader.h
index 52046f8dd5..8e82bd7a31 100644
--- a/backends/graphics/opengl/pipelines/shader.h
+++ b/backends/graphics/opengl/pipelines/shader.h
@@ -42,6 +42,7 @@ public:
protected:
virtual void activateInternal();
+ virtual void deactivateInternal();
Shader *const _activeShader;
};