summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/glwrapper-ogl.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-07-11 17:33:42 +0200
committerAdam Borowski <kilobyte@angband.pl>2012-07-11 17:36:22 +0200
commit9d32731bcc1e6c72d7618ca41cc98b6aba99505b (patch)
tree730ce3d8b308e69588b6c55d7df5430ebbe24947 /crawl-ref/source/glwrapper-ogl.cc
parent28812c7f27d6cc6e24a38308d5b666cb24e11a59 (diff)
parentadef487f6c1f76020ffa2bc7fb41d92f871415f0 (diff)
downloadcrawl-ref-9d32731bcc1e6c72d7618ca41cc98b6aba99505b.tar.gz
crawl-ref-9d32731bcc1e6c72d7618ca41cc98b6aba99505b.zip
Merge branch 'unicode-tiles'
It lacks an actual font yet, but I realized we need to check if drivers people use actually support sub-textures -- and if not, there'll be some rethinking needed.
Diffstat (limited to 'crawl-ref/source/glwrapper-ogl.cc')
-rw-r--r--crawl-ref/source/glwrapper-ogl.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/crawl-ref/source/glwrapper-ogl.cc b/crawl-ref/source/glwrapper-ogl.cc
index 0efd359689..eb25715cc2 100644
--- a/crawl-ref/source/glwrapper-ogl.cc
+++ b/crawl-ref/source/glwrapper-ogl.cc
@@ -184,7 +184,8 @@ void OGLStateManager::bind_texture(unsigned int texture)
}
void OGLStateManager::load_texture(unsigned char *pixels, unsigned int width,
- unsigned int height, MipMapOptions mip_opt)
+ unsigned int height, MipMapOptions mip_opt,
+ int xoffset, int yoffset)
{
// Assumptions...
const unsigned int bpp = 4;
@@ -214,8 +215,12 @@ void OGLStateManager::load_texture(unsigned char *pixels, unsigned int width,
{
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexImage2D(GL_TEXTURE_2D, 0, bpp, width, height, 0,
- texture_format, format, pixels);
+ if( xoffset >= 0 && yoffset >= 0 )
+ glTexSubImage2D(GL_TEXTURE_2D, 0, xoffset, yoffset, width, height,
+ texture_format, format, pixels);
+ else
+ glTexImage2D(GL_TEXTURE_2D, 0, bpp, width, height, 0,
+ texture_format, format, pixels);
}
}