summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/glwrapper-ogl.cc
diff options
context:
space:
mode:
authorfrogbotherer <therealchriswest@hotmail.com>2012-07-08 16:16:41 +0100
committerAdam Borowski <kilobyte@angband.pl>2012-07-08 22:56:06 +0200
commit2b9d1cd128bf49181203f7936c34b0e5858a4202 (patch)
tree9e8a1c72942e1db28d472c866782e9aad4f317af /crawl-ref/source/glwrapper-ogl.cc
parentf79dc8e539c9217bc918c026ce3bdbb2cf20dde4 (diff)
downloadcrawl-ref-2b9d1cd128bf49181203f7936c34b0e5858a4202.tar.gz
crawl-ref-2b9d1cd128bf49181203f7936c34b0e5858a4202.zip
more efficient font rendering using glTexSubImage2D
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 c5b4651045..6e8c935e37 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);
}
}