summaryrefslogtreecommitdiff
path: root/src/video/opengl.h
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-02-24 22:10:25 +0100
committerGitHub <noreply@github.com>2021-02-24 22:10:25 +0100
commite1e8cc38513c0131ad6a5764219b308f912dfee9 (patch)
tree25ab453bbfef04587ea79bca9ddaef5cae41bb08 /src/video/opengl.h
parent6a8c461e38360d14fc36d77a63150a07c6e64ff9 (diff)
downloadopenttd-e1e8cc38513c0131ad6a5764219b308f912dfee9.tar.xz
Fix #8734: [OpenGL] Apply palette remap to cursor sprites. (#8742)
Diffstat (limited to 'src/video/opengl.h')
-rw-r--r--src/video/opengl.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/video/opengl.h b/src/video/opengl.h
index 86c0b0d17..373345063 100644
--- a/src/video/opengl.h
+++ b/src/video/opengl.h
@@ -54,7 +54,15 @@ private:
GLint remap_zoom_loc; ///< Uniform location for sprite zoom;
GLint remap_rgb_loc; ///< Uniform location for RGB mode flag;
- LRUCache<SpriteID, Sprite> cursor_cache; ///< Cache of encoded cursor sprites.
+ GLuint sprite_program; ///< Shader program for blending and rendering a sprite to the video buffer.
+ GLint sprite_sprite_loc; ///< Uniform location for sprite parameters.
+ GLint sprite_screen_loc; ///< Uniform location for screen size;
+ GLint sprite_zoom_loc; ///< Uniform location for sprite zoom;
+ GLint sprite_rgb_loc; ///< Uniform location for RGB mode flag;
+ GLint sprite_crash_loc; ///< Uniform location for crash remap mode flag;
+
+ LRUCache<SpriteID, Sprite> cursor_cache; ///< Cache of encoded cursor sprites.
+ PaletteID last_sprite_pal = (PaletteID)-1; ///< Last uploaded remap palette.
OpenGLBackend();
~OpenGLBackend();
@@ -62,7 +70,7 @@ private:
const char *Init();
bool InitShaders();
- void RenderOglSprite(OpenGLSprite *gl_sprite, uint x, uint y, ZoomLevel zoom);
+ void RenderOglSprite(OpenGLSprite *gl_sprite, PaletteID pal, uint x, uint y, ZoomLevel zoom);
public:
/** Get singleton instance of this class. */
@@ -110,6 +118,10 @@ private:
static GLuint dummy_tex[NUM_TEX]; ///< 1x1 dummy textures to substitute for unused sprite components.
+ static GLuint pal_identity; ///< Identity texture mapping.
+ static GLuint pal_tex; ///< Texture for palette remap.
+ static GLuint pal_pbo; ///< Pixel buffer object for remap upload.
+
static bool Create();
static void Destroy();