mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-05-30 21:51:28 +00:00
[client] opengl: scale UI elements on high DPI displays
This is done by simply scaling up the rendered text bitmap.
This commit is contained in:
parent
fd50426dda
commit
48be58378c
@ -111,6 +111,7 @@ struct Inst
|
|||||||
LG_DSGLContext glContext;
|
LG_DSGLContext glContext;
|
||||||
|
|
||||||
SDL_Point window;
|
SDL_Point window;
|
||||||
|
float uiScale;
|
||||||
bool frameUpdate;
|
bool frameUpdate;
|
||||||
|
|
||||||
const LG_Font * font;
|
const LG_Font * font;
|
||||||
@ -305,6 +306,7 @@ void opengl_on_resize(void * opaque, const int width, const int height, const do
|
|||||||
|
|
||||||
this->window.x = width * scale;
|
this->window.x = width * scale;
|
||||||
this->window.y = height * scale;
|
this->window.y = height * scale;
|
||||||
|
this->uiScale = (float) scale;
|
||||||
|
|
||||||
if (destRect.valid)
|
if (destRect.valid)
|
||||||
{
|
{
|
||||||
@ -661,6 +663,7 @@ bool opengl_render(void * opaque, LG_RendererRotate rotate)
|
|||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glTranslatef(this->window.x / 2, this->window.y / 2, 0.0f);
|
glTranslatef(this->window.x / 2, this->window.y / 2, 0.0f);
|
||||||
|
glScalef(this->uiScale, this->uiScale, 1.0f);
|
||||||
glCallList(this->alertList);
|
glCallList(this->alertList);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
break;
|
break;
|
||||||
@ -703,9 +706,6 @@ void opengl_update_fps(void * opaque, const float avgUPS, const float avgFPS)
|
|||||||
this->fpsTexture = true;
|
this->fpsTexture = true;
|
||||||
|
|
||||||
glNewList(this->fpsList, GL_COMPILE);
|
glNewList(this->fpsList, GL_COMPILE);
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
glColor4f(0.0f, 0.0f, 1.0f, 0.5f);
|
glColor4f(0.0f, 0.0f, 1.0f, 0.5f);
|
||||||
@ -727,8 +727,6 @@ void opengl_update_fps(void * opaque, const float avgUPS, const float avgFPS)
|
|||||||
glEnd();
|
glEnd();
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
glEndList();
|
glEndList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user