From e8e7aea6930363b41e8ce5b74b9d6ba01f5ce94d Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 12 Jul 2018 15:32:29 +0100 Subject: [PATCH] Fix off-by-one character error in immediate mode GL text rendering --- renderdoc/driver/gl/gl_rendertext.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/renderdoc/driver/gl/gl_rendertext.cpp b/renderdoc/driver/gl/gl_rendertext.cpp index b2089a59f..0bd4bf853 100644 --- a/renderdoc/driver/gl/gl_rendertext.cpp +++ b/renderdoc/driver/gl/gl_rendertext.cpp @@ -501,10 +501,10 @@ void WrappedOpenGL::RenderOverlayStr(float x, float y, bool yflipped, const char while(*prepass) { char c = *prepass; - if(c >= FONT_FIRST_CHAR && c < FONT_LAST_CHAR) + if(c > FONT_FIRST_CHAR && c < FONT_LAST_CHAR) { - stbtt_GetBakedQuad(chardata, FONT_TEX_WIDTH, FONT_TEX_HEIGHT, c - FONT_FIRST_CHAR, &x, &y, - &q, 1); + stbtt_GetBakedQuad(chardata, FONT_TEX_WIDTH, FONT_TEX_HEIGHT, c - FONT_FIRST_CHAR - 1, &x, + &y, &q, 1); maxx = RDCMAX(maxx, RDCMAX(q.x0, q.x1)); maxy = RDCMAX(maxy, RDCMAX(q.y0, q.y1)); @@ -534,10 +534,10 @@ void WrappedOpenGL::RenderOverlayStr(float x, float y, bool yflipped, const char while(*text) { char c = *text; - if(c >= FONT_FIRST_CHAR && c < FONT_LAST_CHAR) + if(c > FONT_FIRST_CHAR && c < FONT_LAST_CHAR) { - stbtt_GetBakedQuad(chardata, FONT_TEX_WIDTH, FONT_TEX_HEIGHT, c - FONT_FIRST_CHAR, &x, &y, - &q, 1); + stbtt_GetBakedQuad(chardata, FONT_TEX_WIDTH, FONT_TEX_HEIGHT, c - FONT_FIRST_CHAR - 1, &x, + &y, &q, 1); vertices.push_back(Vec4f(q.x0, q.y0 * mul, q.s0, q.t0)); vertices.push_back(Vec4f(q.x1, q.y0 * mul, q.s1, q.t0));