diff options
author | Johannes Schickel | 2016-01-06 16:52:03 +0100 |
---|---|---|
committer | Johannes Schickel | 2016-03-16 20:29:27 +0100 |
commit | b17c035642cc33ee614046be011bf8ad9f9db95d (patch) | |
tree | c4e8cdbde2049ae9e4ff775e492e9957a7109539 /backends/graphics/opengl/pipeline.h | |
parent | 0fe580d10c6fb73a90eccb046c8dcbf84b062b16 (diff) | |
download | scummvm-rg350-b17c035642cc33ee614046be011bf8ad9f9db95d.tar.gz scummvm-rg350-b17c035642cc33ee614046be011bf8ad9f9db95d.tar.bz2 scummvm-rg350-b17c035642cc33ee614046be011bf8ad9f9db95d.zip |
OPENGL: Implement texture drawing in Pipeline instead of Surface.
Diffstat (limited to 'backends/graphics/opengl/pipeline.h')
-rw-r--r-- | backends/graphics/opengl/pipeline.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/backends/graphics/opengl/pipeline.h b/backends/graphics/opengl/pipeline.h index d101a99d9b..5ec52f2f28 100644 --- a/backends/graphics/opengl/pipeline.h +++ b/backends/graphics/opengl/pipeline.h @@ -24,6 +24,7 @@ #define BACKENDS_GRAPHICS_OPENGL_PIEPLINE_H #include "backends/graphics/opengl/opengl-sys.h" +#include "backends/graphics/opengl/texture.h" namespace OpenGL { @@ -87,13 +88,22 @@ public: virtual void setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) = 0; /** - * Setup coordinates for drawing with glDrawArrays. + * Draw a texture rectangle to the currently active framebuffer. * - * @param vertices The list of vertices, 2 coordinates for each vertex. - * @param texCoords The list of texture coordinates, 2 coordinates for - * each vertex. + * @param texture Texture to use for drawing. + * @param coordinates x1, y1, x2, y2 coordinates where to draw the texture. */ - virtual void setDrawCoordinates(const GLfloat *vertices, const GLfloat *texCoords) = 0; + virtual void drawTexture(const GLTexture &texture, const GLfloat *coordinates) = 0; + + void drawTexture(const GLTexture &texture, GLfloat x, GLfloat y, GLfloat w, GLfloat h) { + const GLfloat coordinates[4*2] = { + x, y, + x + w, y, + x, y + h, + x + w, y + h + }; + drawTexture(texture, coordinates); + } /** * Set the projection matrix. @@ -113,7 +123,7 @@ public: virtual void setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a); - virtual void setDrawCoordinates(const GLfloat *vertices, const GLfloat *texCoords); + virtual void drawTexture(const GLTexture &texture, const GLfloat *coordinates); virtual void setProjectionMatrix(const GLfloat *projectionMatrix); }; @@ -130,7 +140,7 @@ public: virtual void setColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a); - virtual void setDrawCoordinates(const GLfloat *vertices, const GLfloat *texCoords); + virtual void drawTexture(const GLTexture &texture, const GLfloat *coordinates); virtual void setProjectionMatrix(const GLfloat *projectionMatrix); |