mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 11:52:40 +01:00
Correctly account for DPI scaling when setting viewport size.
This commit is contained in:
parent
45107f5afb
commit
6c3935cbf6
@ -128,7 +128,7 @@ void ViewerWidget::drawWorld(GameRenderer& r) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ViewerWidget::paintGL() {
|
void ViewerWidget::paintGL() {
|
||||||
glViewport(0, 0, width(), height());
|
glViewport(0, 0, width() * devicePixelRatio(), height() * devicePixelRatio());
|
||||||
glClearColor(0.3f, 0.3f, 0.3f, 1.f);
|
glClearColor(0.3f, 0.3f, 0.3f, 1.f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ void ViewerWidget::paintGL() {
|
|||||||
RW_CHECK(_renderer != nullptr, "GameRenderer is null");
|
RW_CHECK(_renderer != nullptr, "GameRenderer is null");
|
||||||
auto& r = *_renderer;
|
auto& r = *_renderer;
|
||||||
r.getRenderer()->invalidate();
|
r.getRenderer()->invalidate();
|
||||||
r.setViewport(width(), height());
|
r.setViewport(width() * devicePixelRatio(), height() * devicePixelRatio());
|
||||||
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user