[client] opengl: support scaled UI for high DPI displays

This commit is contained in:
Quantum 2021-02-21 00:53:14 -05:00 committed by Geoffrey McRae
parent 3ec73e2444
commit 89bdaec95a

View File

@ -303,11 +303,17 @@ void opengl_on_resize(void * opaque, const int width, const int height, const do
{ {
struct Inst * this = (struct Inst *)opaque; struct Inst * this = (struct Inst *)opaque;
this->window.x = width; this->window.x = width * scale;
this->window.y = height; this->window.y = height * scale;
if (destRect.valid) if (destRect.valid)
memcpy(&this->destRect, &destRect, sizeof(LG_RendererRect)); {
this->destRect.valid = true;
this->destRect.x = destRect.x * scale;
this->destRect.y = destRect.y * scale;
this->destRect.w = destRect.w * scale;
this->destRect.h = destRect.h * scale;
}
// setup the projection matrix // setup the projection matrix
glViewport(0, 0, this->window.x, this->window.y); glViewport(0, 0, this->window.x, this->window.y);