[GL] fix OSD messages breaking if one was too long

This commit is contained in:
ToadKing 2013-08-22 23:21:52 -04:00
parent 0cdd3de835
commit be08d003c9
2 changed files with 7 additions and 0 deletions

View File

@ -35,6 +35,7 @@ static bool gl_init_font(void *data, const char *font_path, float font_size)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl->max_font_size);
}
else
{
@ -124,6 +125,11 @@ static void adjust_power_of_two(gl_t *gl, struct font_rect *geom)
geom->pot_width = next_pow2(geom->width);
geom->pot_height = next_pow2(geom->height);
if (geom->pot_width > gl->max_font_size)
geom->pot_width = gl->max_font_size;
if (geom->pot_height > gl->max_font_size)
geom->pot_height = gl->max_font_size;
if ((geom->pot_width > gl->font_tex_w) || (geom->pot_height > gl->font_tex_h))
{
gl->font_tex_buf = (uint32_t*)realloc(gl->font_tex_buf,

View File

@ -207,6 +207,7 @@ typedef struct gl
const gl_font_renderer_t *font_ctx;
const font_renderer_driver_t *font_driver;
GLuint font_tex;
GLint max_font_size;
int font_tex_w, font_tex_h;
uint32_t *font_tex_buf;
char font_last_msg[256];