diff options
author | Johannes Schickel | 2016-01-04 11:38:21 +0100 |
---|---|---|
committer | Johannes Schickel | 2016-03-16 20:29:27 +0100 |
commit | 0fe580d10c6fb73a90eccb046c8dcbf84b062b16 (patch) | |
tree | 374a7e245e5b39caa120de0ae9c4e3d19dba60ee /backends/graphics/opengl/pipeline.h | |
parent | 0b46af2f0e5eef939daa73d5b38b6b817c78c7d8 (diff) | |
download | scummvm-rg350-0fe580d10c6fb73a90eccb046c8dcbf84b062b16.tar.gz scummvm-rg350-0fe580d10c6fb73a90eccb046c8dcbf84b062b16.tar.bz2 scummvm-rg350-0fe580d10c6fb73a90eccb046c8dcbf84b062b16.zip |
OPENGL: Make shader/framebuffer part of pipeline state.
Diffstat (limited to 'backends/graphics/opengl/pipeline.h')
-rw-r--r-- | backends/graphics/opengl/pipeline.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/backends/graphics/opengl/pipeline.h b/backends/graphics/opengl/pipeline.h index e12390bcce..d101a99d9b 100644 --- a/backends/graphics/opengl/pipeline.h +++ b/backends/graphics/opengl/pipeline.h @@ -27,6 +27,11 @@ namespace OpenGL { +class Framebuffer; +#if !USE_FORCED_GLES +class Shader; +#endif + /** * Interface for OpenGL pipeline functionality. * @@ -35,6 +40,7 @@ namespace OpenGL { */ class Pipeline { public: + Pipeline(); virtual ~Pipeline() {} /** @@ -46,6 +52,31 @@ public: virtual void activate() = 0; /** + * Set framebuffer to render to. + * + * Client is responsible for any memory management related to framebuffer. + * + * @param framebuffer Framebuffer to activate. + * @return Formerly active framebuffer. + */ + Framebuffer *setFramebuffer(Framebuffer *framebuffer); + +#if !USE_FORCED_GLES + /** + * Set shader program. + * + * Not all pipelines support shader programs. This is method exits at this + * place for convenience only. + * + * Client is responsible for any memory management related to shader. + * + * @param shader Shader program to activate. + * @return Formerly active shader program. + */ + virtual Shader *setShader(Shader *shader) { return nullptr; } +#endif + + /** * Set modulation color. * * @param r Red component in [0,1]. @@ -63,6 +94,16 @@ public: * each vertex. */ virtual void setDrawCoordinates(const GLfloat *vertices, const GLfloat *texCoords) = 0; + + /** + * Set the projection matrix. + * + * This is intended to be only ever be used by Framebuffer subclasses. + */ + virtual void setProjectionMatrix(const GLfloat *projectionMatrix) = 0; + +protected: + Framebuffer *_activeFramebuffer; }; #if !USE_FORCED_GLES2 @@ -73,17 +114,28 @@ public: virtual void setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a); virtual void setDrawCoordinates(const GLfloat *vertices, const GLfloat *texCoords); + + virtual void setProjectionMatrix(const GLfloat *projectionMatrix); }; #endif // !USE_FORCED_GLES2 #if !USE_FORCED_GLES class ShaderPipeline : public Pipeline { public: + ShaderPipeline(); + virtual void activate(); + virtual Shader *setShader(Shader *shader); + virtual void setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a); virtual void setDrawCoordinates(const GLfloat *vertices, const GLfloat *texCoords); + + virtual void setProjectionMatrix(const GLfloat *projectionMatrix); + +private: + Shader *_activeShader; }; #endif // !USE_FORCED_GLES |