OGL: Scale OSD text on big screens.

This commit is contained in:
degasus 2018-03-12 00:34:46 +01:00 committed by Markus Wick
parent d4449971c9
commit a5c0739fab
2 changed files with 12 additions and 4 deletions

View File

@ -157,6 +157,7 @@ RasterFont::RasterFont()
}
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, CHARACTER_WIDTH * CHARACTER_COUNT, CHARACTER_HEIGHT, 0,
GL_RGBA, GL_UNSIGNED_BYTE, texture_data.data());

View File

@ -851,10 +851,17 @@ Renderer::CreateFramebuffer(const AbstractTexture* color_attachment,
void Renderer::RenderText(const std::string& text, int left, int top, u32 color)
{
s_raster_font->printMultilineText(text,
left * 2.0f / static_cast<float>(m_backbuffer_width) - 1.0f,
1.0f - top * 2.0f / static_cast<float>(m_backbuffer_height), 0,
m_backbuffer_width, m_backbuffer_height, color);
int screen_width = m_backbuffer_width;
int screen_height = m_backbuffer_height;
if (screen_width >= 2000)
{
screen_width /= 2;
screen_height /= 2;
}
s_raster_font->printMultilineText(text, left * 2.0f / static_cast<float>(screen_width) - 1.0f,
1.0f - top * 2.0f / static_cast<float>(screen_height), 0,
screen_width, screen_height, color);
}
std::unique_ptr<AbstractShader> Renderer::CreateShaderFromSource(ShaderStage stage,